问题描述:

I have a function file with my differential equations, I am performing a ode23s on the function in the standard form i.e

[t,m]=ode23s('DE_function',tspan,[mA pA mB pB mC pC mD],optionsDE,p)

I obtain about 150 values/results/output for each mA and so on. My ode23s is working fine.

I have experimental dataset for the same mA and so on which i have to use to calculate the least squared error.. i am trying to do this:

a = m(:,1) - A(:,2); and so on. Here in my experimental data, I have just 20 values/results/outputs etc according to 20 time points. I have defined the same time points for the tspan as well. But since my matrices do not match in dimension, i am unable to proceed with my calculations. Is there a way to receive exactly 20 values according to the 20 time points such as 1, 2, etc in the ode23s as well, or may be a way to get and store them only.

I have been trying to find a solution for this error but unable to find anything suitable. Many thanks for any kind of suggestions and hits.

The Matlab documentation has all you need. When you call ode23 you can specify the time locations in tspan.

"Interval of integration, specified as a vector. At minimum, tspan must be a two element vector [t0 tf] specifying the initial and final times. To obtain solutions at specific times between t0 and tf, use a longer vector of the form [t0,t1,t2,...,tf]. The elements in tspan must be all increasing or all decreasing."