Hi I have a equations here, and I wonder it to do phase plane.How to do it?

 채택된 답변

Mischa Kim
Mischa Kim 2016년 11월 10일

1 개 추천

Hello, check out the code below:
function my_ODE()
th0 = 0;
Dth0 = 1;
tspan = linspace(0,2,200);
options = odeset('RelTol',1e-8,'AbsTol',1e-10);
[~,X] = ode45(@DE, tspan,[th0; Dth0],options);
plot(X(:,1),X(:,2))
grid
end
function dX = DE(~,x)
dX = [x(2); u(x(1))];
end
function uval = u(x1)
if (x1 < 0)
uval = +5;
else
uval = -5;
end
end

댓글 수: 1

JIE YUANG LU
JIE YUANG LU 2016년 11월 11일
편집: JIE YUANG LU 2016년 11월 11일
so when I change U condition which code to change? and what is DE?

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

추가 답변 (0개)

카테고리

태그

질문:

2016년 11월 10일

편집:

2016년 11월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by