- Load and preprocess the image using “imread” to load the image and “rgb2gray” to convert it into greyscale.
- Enhance the image using “imadjust” and then apply edge detection function “edge”.
- Use “bwlabel” and “regionprops” to identify and extract the centroids of the plot lines.
- Convert pixel to data coordinates by mapping the pixel coordinates to actual data coordinates using known axis scales.
how to plot frequency vs distance surface plot from frequency vs wave-vector surface plot?
4 views (last 30 days)
Show older comments
This type of dispersion plot I have. I want to convert it to f vs distance plot.

0 Comments
Answers (1)
Charu
on 20 Feb 2025
Hello Amrit,
From my perspective you are trying to plot a frequency v/s distance surface plot from a frequency v/s wave-vector surface plot.
You might consider using the relation (\lambda = \frac{v}{f}) if the speed of propagation (v) is known, which could help in determining the distance under specific conditions. If the data is not readily available, another approach could be to extract it from the graph using MATLAB functions of image processing toolbox. Here is how you can do it:
Here is a code snippet for that:
img = imread('plot_image.png');
grayImg = rgb2gray(img);
enhancedImg = imadjust(grayImg);
edges = edge(enhancedImg, 'Canny');
[labeledImage, numObjects] = bwlabel(edges);
stats = regionprops(labeledImage, 'Centroid');
centroids = cat(1, stats.Centroid);
After extracting the data convert the wave-vector data to distance with the relation (\lambda = \frac{2\pi}{k}). To create a surface plot in MATLAB for a function f versus distance, you can use the ‘surf’ function as shown below:
surf(d, f, Z);
%where d is distance, f is frequency
% You can replace the function Z with your specific data or function to visualize.
To know more about the functions used you can refer to these documentation links given below:
0 Comments
See Also
Categories
Find more on 3-D Volumetric Image Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!