How do I force ode45 to take steps of exactly 0.01 on the T axis?

前端 未结 6 1914
再見小時候
再見小時候 2021-01-05 14:44

I\'m using Matlab to solve a differential equation. I want to force ode45 to take constant steps, so it always increments 0.01 on the T axis while solving the equation. How

6条回答
  •  青春惊慌失措
    2021-01-05 14:55

    This can be done just need to use a few more commands.

    NEW:

    options= odeset('Reltol',0.001,'Stats','on');
    
    %figure(1);
    %clf;
    init=[xo yo zo]';
    to=some number; 
    tf= some number;
    nsteps= number of points you want function evaluated on.
    tspan = linspace(t0,tf, nsteps);
    
    [T,Y]=ode45(@function,tspan,init,options);
    

    You can verify that it took the number points that you wanted using the command size(variable).

提交回复
热议问题