Filter löschen
Filter löschen

Using ODE 45 function to solve differential equation

1 Ansicht (letzte 30 Tage)
Stephanie Velasco
Stephanie Velasco am 24 Feb. 2017
Kommentiert: Sudarshan Kolar am 27 Feb. 2017
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 Kommentar
Sudarshan Kolar
Sudarshan Kolar am 27 Feb. 2017
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by