How to check the complementary time-dependent term of differential equations.
1 回表示 (過去 30 日間)
古いコメントを表示
Is there any way to check how the time-dependent term ft in the following code is completed by interp1?
function [T1,Y1] = ode_param_sample1()
TSPAN = [0 pi/2];
IC = 1;
tv = linspace(0,pi/2,10);
ftv = sin(tv);
[T1 Y1] = ode45(@myODE1, TSPAN, IC);
function dydt1 = myODE1(t1,y1)
ft = interp1(tv, ftv, t1,'spline');
dydt1 = - ft *y1;
end
end
I want to check the ft in this code.
By checking, I mean I want to compare it with the original time-variant parameters, such as plotting it on a graph.
0 件のコメント
回答 (1 件)
SALAH ALRABEEI
2021 年 6 月 7 日
% Try this
function [T1,Y1] = ode_param_sample1()
TSPAN = [0 pi/2];
IC = 1;
tv = linspace(0,pi/2,10);
ftv = sin(tv);
ft = interp1(tv, ftv, T1,'spline');
plot(tv,ftv,'or',T1,ft,'b')
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!