Hello,
I'm looking for some general ideas / suggestions about my current problem. I need to write some functions that will extract interesting data points (min,max, p-p,etc) from a plotted sine wave. The wave has not been created yet. A coworker will create the equations that will generate this wave at a later date, so I don't know if he will be plotting an actual sine wave, or if he will have points that will become a wave form. So I cannot simply take values from a single equation. I hope that makes sense so far. Basically, I'm doing the post-processing work on his plot so that when he creates the equations and plots, the whole program will run, and my functions will appropriately extract the information needed. Does anyone have any suggestions on a stable way to extract interesting information as mentioned from a currently unknown plot? Or to even extract ALL values in defined timesteps?
It seems that there are so many ways to do something like this, so I'm hoping for some guidance to know which paths might be better than others. I will be creating test plots while doing this, but I cannot be sure of the end outcome, except that they will be sine waves.

댓글 수: 4

Image Analyst
Image Analyst 2014년 10월 2일
편집: Image Analyst 2014년 10월 2일
We can't answer until we know what form "a plotted sine wave" takes. Will you have the actual equations in an m-file so that you can regenerate the data? Will you have an image/screenshot/fig-file of the plot? Will you have a paper plot/printout? Of course if you have the equations, it's trivial - just use the max() and min() functions on the output of the equations.
katerina
katerina 2014년 10월 2일
I will have access to whatever calculations have been made, but the purpose of my creating the post-processing work now is so that when my coworker has time to create the calculations, it will be ready for use. So I cannot assume to have anything more than a matlab plotted figure. I cannot even assume to have a sine function.
Image Analyst
Image Analyst 2014년 10월 2일
Why doesn't he just call max() or min() after he plots it? How hard would that be?
katerina
katerina 2014년 10월 2일
hahahahaha! - very good question. I work with all mechanical engineers, so most of them prefer to have minimal contact with script / function-writing.

댓글을 달려면 로그인하십시오.

 채택된 답변

Star Strider
Star Strider 2014년 10월 2일

0 개 추천

You have to extract the entire data series from a plot. If you have the plot open in your workspace, the easiest way is to use the appropriate handle graphics calls:
xd = get(gca, 'XData');
yd = get(gca, 'YData');
and then analyse ‘xd’ and ‘yd’ as you wish.

댓글 수: 2

katerina
katerina 2014년 10월 2일
This looks great. Thank you!
Star Strider
Star Strider 2014년 10월 2일
편집: Star Strider 2014년 10월 2일
My pleasure!
Note: ‘plot open in your workspace’ means as a ‘.fig’ file. An image file will not have that information.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

질문:

2014년 10월 2일

댓글:

2014년 10월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by