MATLAB: Ploting equation and experimental data in the same plot

equationexperimental dataplotting

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.

Best Answer

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