how to plot graph
2 views (last 30 days)
Show older comments
Can anyone tell how to plot the following graph plz
0 Comments
Accepted Answer
Walter Roberson
on 1 Jun 2013
is it possible to do using sin or cos function with for loop
Yes, but you probably don't want to do that.
The curve you show is not a simple sine or cosine or simple sum or product of sines or cosines. However, since the curve has a finite number of samples (pixels), you could measure the coordinates on a pixel-by-pixel basis and then use an FFT to transform it into an implicit sum of sine waves, each with amplitude and phase. And then, with those amplitude and phase components on hand, you could go through the trouble of reconstructing the plot by calculating all of the sine components and adding them all up. That would be a loop using sine functions. But if you had all of the measurements needed to do this, it would be a lot more efficient to just plot in (x,y) coordinates directly.
Somewhere in the File Exchange is (or was!) a routine that could read image files and interpret the image as a graph to figure out what the data values were. Unfortunately I cannot seem to find the routine.
1 Comment
Image Analyst
on 1 Jun 2013
Edited: Image Analyst
on 1 Jun 2013
I've had that one bookmarked for a while:
He could also read in the image with imread() and then use imfreehand (in the Image Processing Toolbox) to trace the curve getting coordinates. Then use ginput(1) to locate the origin and subtract this from the coordinates returned from imfreehand. Then put in the graph units to pixels ratio as a calibration factor that you multiply by, and you're done.
More Answers (1)
Azzi Abdelmalek
on 1 Jun 2013
Edited: Azzi Abdelmalek
on 1 Jun 2013
If you have the data (y for example) use
plot(y)
legend('ESD status')
grid on
4 Comments
Azzi Abdelmalek
on 1 Jun 2013
Edited: Azzi Abdelmalek
on 1 Jun 2013
But it 's not a cos or sin function. Can you explain what is your goal? and what this curve represent?
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!