how to plot graph
2 次查看(过去 30 天)
显示 更早的评论
Can anyone tell how to plot the following graph plz
0 个评论
采纳的回答
Walter Roberson
2013-6-1
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 个评论
Image Analyst
2013-6-1
编辑:Image Analyst
2013-6-1
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.
更多回答(1 个)
Azzi Abdelmalek
2013-6-1
编辑:Azzi Abdelmalek
2013-6-1
If you have the data (y for example) use
plot(y)
legend('ESD status')
grid on
4 个评论
Azzi Abdelmalek
2013-6-1
编辑:Azzi Abdelmalek
2013-6-1
But it 's not a cos or sin function. Can you explain what is your goal? and what this curve represent?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!