필터 지우기
필터 지우기

How to check the complementary time-dependent term of differential equations.

조회 수: 1 (최근 30일)
CT
CT 2021년 6월 7일
댓글: CT 2021년 6월 7일
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.

답변 (1개)

SALAH ALRABEEI
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')
  댓글 수: 1
CT
CT 2021년 6월 7일
I tried, but I couldn't.
I get the message "The function or variable 'T1' is not recognized."

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by