Representing and approximating third order differential equations
조회 수: 6 (최근 30일)
이전 댓글 표시
I am trying to approximate a differential equation in terms of two vectors, x any y and also return a value of a solution. My differential equation is hard to represent though:
d3y/dx3 + dy/dx - xy + d2y/dx2 = 2 xE[1, 5]
initial conditions y(0), dy/dx(0) and d2y/dx2(0) have been given.
Any suggestions?
댓글 수: 1
답변 (1개)
Francisco Angel
2014년 4월 3일
편집: Francisco Angel
2014년 4월 3일
Transform the problem in a system of first order differential equations:
dy1 / dx = y2 dy2 / dx = y3 dy3 / dx = 2-y3-x*y1-y2
with initial conditions y1(0) y2(0) and y3(0) then solve it using ode45 for example:
if true
% code
[t,Y]=ode45(@system,[1 5],[y1(0) y2(0) y3(0)]);
function dy=system(X,Y)
dy(1)=Y(2);
dy(2)=Y(3);
dy(3)=2-Y(3)-X*Y(1)-Y(2);
dy=dy';
end
end
In doubt check formatting issues tipyng help ode45 in command line.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!