필터 지우기
필터 지우기

2nd order ODE with variable coefficients

조회 수: 2 (최근 30일)
Sushant
Sushant 2013년 11월 9일
댓글: Sushant 2013년 11월 14일
Ok so I am new to matlab and need help to solve this ODE. Plz tell me how to do it in matlab.
y'' + y'(0.75 + 0.5sin(x)) + y(1.3225 + 0.5cos(x) + 0.1875sin(2x)) = 0
Initial Conditions: y(0) = 0.6 and y'(0) = 0
Thankyou

채택된 답변

Ben Petschel
Ben Petschel 2013년 11월 12일
You'll need to rewrite the second-order ODE as a first-order vector ODE. Put y1=y, y2=y1', so y2'=y''. Try ode45, with
f = @(x,y)[y(2);-(y(2)*(0.75+0.5*sin(x))-y(1)*(1.3225+0.5*cos(x)+0.1875*sin(2*x))];
[x,y] = ode45(f,[0,xmax],[0.6;0])
  댓글 수: 1
Sushant
Sushant 2013년 11월 14일
Oh I see. That was a really nice way to do it :) Thanks a lot :)

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

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