I have an ode15s function solving equations in a loop for several values of different parameters. I have to plot all my results in one plot, so I have to have all results in one array. Here's my code:
time=linspace(0,1,101);x=[0;0;0;0;0;0;0;0]; Force=@(t)modelforce(0);z=zeros(12,8)for i=1:100 T=time(i); TT=time(i+1); F=Force(i); opt=odeset('AbsTol',1e-9,'RelTol',1e-6); [tt,z]=ode15s(@(F,x) ode11(F,x),[T TT],x);real_z=real(z);imaj_z=imag(z);x=z(end,:); % new initial condition for the next values of F, and new time intervals.
end
My problem is at the end – I need to put all my results in two matrixes one for real values and the other for imaginary values but ode15s give results as different arrays (different lengths) and I don't know how to change that (if it's even possible) to combine them as one array.
Best Answer