MATLAB: Ode45

ode45

Hello,
When using ode45, I know I can specify the integrand as a function of time. For instance, dx/dt = cos(t) – x.
Is there a way to alternatively specify the integrand as a set of data points? For instance replace cos(t) with a set of data points that I load.
When I try doing this I'm getting an error. I think because of the internal time steps ode45 uses is different than the times steps in my data points. Changing the tspan input to match the time steps in my data points doesn't seem to make any difference in the internal time steps ode45 uses. Is there any way around this problem?
Thank you, Kevin

Best Answer

This sounds like a job for TRAPZ.
Related Question