Ploting equation and experimental data in the same plot

Hi. I had a very long differential equation and solved it using ode45. Now there is an excel file with experimental data. How can I plot the equation and experimental data in the plot to see if they fit? Thank you.

 採用された回答

Star Strider
Star Strider 2015 年 9 月 6 日

0 投票

Use the xlsread function to read the Excel file. Then plot your results on the same axes you plot your ODE solution on.
Hypothetical code might be something like this:
d = xlsread(filename);
time = d(:,1);
data = d(:,2);
. . .
[t,y] = ode45( . . . );
. . .
figure(1)
plot(t, y)
hold on
plot(time, data)
hold off
grid

2 件のコメント

AbiAbi
AbiAbi 2015 年 9 月 7 日
It worked. Thank you
Star Strider
Star Strider 2015 年 9 月 7 日
My pleasure.

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

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by