Borrar filtros
Borrar filtros

Can I store ode23 the function handle parameters?

1 visualización (últimos 30 días)
Muna Shehan
Muna Shehan el 11 de Jul. de 2016
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

Respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by