필터 지우기
필터 지우기

Using ODE 45 function to solve differential equation

조회 수: 1 (최근 30일)
Stephanie Velasco
Stephanie Velasco 2017년 2월 24일
댓글: Sudarshan Kolar 2017년 2월 27일
I have figured out how to use the Ode 45 equation using this function and it works perfectly find.
function dw_dt = equation_(t,w)
a = 5.05;
b = 2; A=1;
w(A) = a*w(A)^(0.6)-b*w(A);
when i call the function into the script
time_period = [0:.25:20];
w0 = [0.5];
[t,w] = ode45(@equation_,time_period,w0);
, this function works perfectly fine, but now I'm trying to solve for dt/dw, so the equation given, is below, so basically in trying to solve for the time given the weight and initial time of 0.
dt/dw = 1/(a*w^(.6)-b*w)
I'm not sure if the proper to right it in matlab is.
dt = 1/(a*w(1)^(.6)-b*w(1))
given that a is a=5.05 and b=2 and the w range is 0<= w <=20
how will i be able to write the call function if I'm not given a time interval,since thats what I'm trying to solve for?
  댓글 수: 1
Sudarshan Kolar
Sudarshan Kolar 2017년 2월 27일
Stephanie, you can have an independent variable other than time when using ode45. You are thinking in the right direction.
function dtdw = equation2(w,t)
dtdw = 1/(a*w^(.6)-b*w);
end
[w,t] = ode45(@equation2,[0 20],[0])
In fact the documentation mentions that 't' is simply a evaluation point and y is a solution.

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

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