how to obtain data from graph created by user input

1 回表示 (過去 30 日間)
William Fantin
William Fantin 2019 年 5 月 14 日
コメント済み: Geoff Hayes 2019 年 5 月 15 日
Hello All,
I am currently working on a matlab project (GUI). My project is evaluating a spring mass system. The user inputs the mass,spring constant, damping, and external force, then the program graphs equation based on their inputs. I am trying to make a "animation" by drawing boxes in a color, then drawing over them in white and drawing another box etc. I want to make the "mass" (block that I am drawing) move differently based on user input.
My graph is a normal x vs t graph used to represent spring masses in physics and differential equation. My thought process is that I need the x coordinates of this graph so I can then use them for my animation. Does anyone know how to obtain the coordinates of a graph that was drawn based on user input?
Sorry if my question is unclear, I would be more than happy to give more information. I am still trying to figure out how to create my program.
Thanks!
  1 件のコメント
Geoff Hayes
Geoff Hayes 2019 年 5 月 15 日
William - how are you drawing the "graphs"? If you are using plot then you know what the x- and y-data are. And if you save the handle to the plot graphics object, then you can query it for its x- and y-data. For example,
x = linspace(-2*pi, 2*pi, 1000);
y = sin(x);
hPlot = plot(x,y);
xData = get(hPlot,'XData');
yData = get(hPlot, 'YData');

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by