a question on ode23 solver

조회 수: 1 (최근 30일)
cgo
cgo 2017년 6월 1일
편집: Jan 2017년 6월 1일
Hi, I am using ODE23 solver in Matlab.
After inputting the following
t = linspace(0,10);
y0 = 0.5;
u = 1.0;
z = ode23(@(t,y)first_order(t,y,u),t,y0);
time = z.x;
y = z.y;
plot(time,y)
and
function dydt = first_order(t,y,u)
tau = 5;
K = 2.0;
dydt = (-y+K*u)/tau;
end
The output is the plot of time versus y. I wanted to have a plot of y' and t so that I can make an analysis of the ODE without having to solve it. Is there a way of doing it?

채택된 답변

Jan
Jan 2017년 6월 1일
편집: Jan 2017년 6월 1일
You have y and t from the integration the function first_order calculates the needed y' already. Then simply use it after the integration:
dy = first_order(time, y, u);
Then plotting is easy.
But you asked for "make an analysis of the ODE without having to solve it". This is not possible, because you do not have the required trajectory of y without an integration. All you have is the equation in first_order(), which allows to obtain y' depending on t, y and the initial value y0. But you cannot use this without solving the ODE, because then you do not have y(t).

추가 답변 (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