odeset choosing internal stepsize in odesolver ode23 or ode45?

5 views (last 30 days)
I am optimizing a function with fminunc() where an ode is being solved via ode23:
tspan=[0 1 2 3 4 5 6 7 8 9 10] ; Phi0=[0 0 0 0];
[T2,PHI2]=ode23(@(t,Phi)rSeite3b(t,Phi,E,A2),tspan,Phi0);
function dPhi=rSeite3b(t,Phi,E,A2)
% Anfangswerte
A=reshape(A2(9:24),4,4);
Z0=(A2(1:4)*expm(A*t)+A2(5:8)*integral(@(t1) expm((t-t1)*A),0,t,'ArrayValued',true))*E;%
dPhi=zeros(4,1);
% System der DGL
dPhi=(Phi'*A+Z0)';
A2 is a 24-1-Vector,
E is a 4x4 MAtrix with one 1 and all other Positions 0.
function is optimized over A2 (24 variables)
My problem: Calculation is way to slow. PArticularly Z0 needs a lot of time. Since the ode-solver is being used many times, I hope to save time by setting internal step size of ode23 and having Z0 calculating less often, outside of rSeiteb() and only being passed to rSeiteb() as a vector.
I can decide via tspan how the output should look like, but this doesn't help me, since matlab uses internally many more t while calculating ode23 or ode45. I know maxStep but, I would need minStep as well.
Is there a way to manipulate internal step size of the odesolver?
Thanks

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!