필터 지우기
필터 지우기

ODE: How can I trace changing of all parts of equation during solving

조회 수: 1 (최근 30일)
Uladzislau
Uladzislau 2020년 1월 22일
댓글: Uladzislau 2020년 1월 22일
Hello! I'll be grateful if someone could help me. So the question is:
I have an ODE that is been solved correctly.
function [out] = chua(t,in,alpha, beta, A, C, u1st)
x = in(1);
y = in(2);
z = in(3);
xdot = -alpha*((3*A*u1st^2+C+1)*x-y) ...
-3*A*alpha*u1st*x^2...
-A*alpha*x^3;
ydot = x - y + z;
zdot = -beta*y;
out = [xdot ydot zdot]';
The call is:
t = [0 2400];
y = [0.004 0 0];
alpha = 15.6;
beta = 28;
A = 0.002;
C = -1.3;
u1st = 0.5;
[t,y] = ode45(@(t, y) chuaModIris(t, y, alpha, beta, A, C, u1st), t, y );
plot3(y(:,1),y(:,2),y(:,3))
But on each step of integration I need to get extra data - parts of the first equation:
SquarePart = -3*A*alpha*u1st*x^2;
and
CubicPart = -A*alpha*x^3;
Actually, I've already done it in Simulink, but I haven't any idea how to implement it in m-file.

채택된 답변

darova
darova 2020년 1월 22일
What about this?
[t,y] = ode45(@(t, y) chuaModIris(t, y, alpha, beta, A, C, u1st), t, y );
plot3(y(:,1),y(:,2),y(:,3))
SquarePart = -3*A*alpha*u1st*y(:,1).^2;
CubicPart = -A*alpha*y(:,1).^3;

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by