Azzera filtri
Azzera filtri

Can I store ode23 the function handle parameters?

1 visualizzazione (ultimi 30 giorni)
Hi all; I use ode23 to solve the ordinary differential equations
[t02,y] = ode23(@(t,x)f(t,x,F,kc, @(t)lookup_u(zdot,t)), [0 2], x00,opt);
As the function handle ( @(t,x)f(t,x,F,kc, @(t)lookup_u(zdot,t)) depends on another function handle ( @(t)lookup_u(zdot,t)) which is
function u = lookup_u(tu, t)
i = find(tu.t <= t, 1, 'last');
[m,n] = size(tu.u);
if (m==1) || (n==1)
if i<length(tu.t)
u = (tu.u(i)*(tu.t(i+1) -t) + tu.u(i+1)*(t-tu.t(i)))/(tu.t(i+1)-tu.t(i));
else
u = tu.u(i);
end
else
if i < length(tu.t)
u = (tu.u(:,i)*(tu.t(i+1) -t) + ...
tu.u(:,i+1)*(t-tu.t(i)))/(tu.t(i+1)-tu.t(i));
else
u = tu.u(:,i);
end
end
end
My question: Is there any way to save t and u values in a vectors as they change at every integration step. Regards

Risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by