필터 지우기
필터 지우기

Can ODE45 solve this equation?

조회 수: 2 (최근 30일)
Martin
Martin 2013년 3월 1일
hi, so I have an ODE that I am solving with ODE45. It basically solves:
d2x/dt2 = exp(-t/tp)cos(t); where tp is a constant.
It is giveing really good results so far. I now need to solve:
d2x/dt2 = exp(-t/tp)cos(t)exp(-bx); where tp and b are constants
So you can see here that there is now an x dependence on the LHS rather than just time dependence. Is this something that can be solved using ODE45 as I seem to be getting no change in results by adding this?
Thanks

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 1일
When you write x1=x and x2=dx/dt you will have a DE system which can be resolved as
function dx=fcn(t,x,tp,b)
dx=zeros(2,1)
dx(1)=x(2)
dx(2)=exp(-t/tp)*cos(t)*exp(-b*x(1))
%---------------------------------
Call your function
tp=1;
b=1;
[t,x]=ode45(@(t,x) fcnn1(t,x,tp,b),[0,100],[0 0]),
out=x(:,1)
  댓글 수: 1
Martin
Martin 2013년 3월 5일
cheers mate, unfortunately the ODE45 solver and my runge-kutta program completely ignores the exp(-bx), even with b=10000 (or some other random massive/tiny number!)

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

카테고리

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