필터 지우기
필터 지우기

How to solve coupled differential equation in a limited range of the variable?

조회 수: 1 (최근 30일)
I need to solve the following set of coupled equations.(these are not the exact equations,but a similar example)
x'=y+x;
y'=2x+y+p;
where
p = y-7 if y>7
= 0 else
I dont know what type they fall into. I have tried using 'dsolve' but to no avail. Any specific matlab function for this case, or even a link to solving such equations would be greatly appreciated.
Thanks in advance.

채택된 답변

Star Strider
Star Strider 2017년 6월 10일
This seems to work:
y = linspace(0,10);
p = (y-7).*(y>7);
figure(1)
plot(y, p)
grid
% % % MAPPING: x = z(1), y = z(2)
de = @(t,z) [z(2) + z(1); 2*z(1) + z(2) + (z(2)-7).*(z(2)>7)];
ts = [0 10];
[T,Z] = ode15s(de, ts, [0.1; 0]);
figure(2)
semilogy(T, Z)
grid
Numerical ODE solvers tend not to do well with discontinuities. That does not seem to be a problem here, probably because ‘p’ is not a ‘step’ or other abrupt discontinuity.
  댓글 수: 4

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by