필터 지우기
필터 지우기

Can I store ode23 the function handle parameters?

조회 수: 1 (최근 30일)
Muna Shehan
Muna Shehan 2016년 7월 11일
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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by