Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

ODE matlab

  1. Apr 9, 2010 #1
    Hi Friends
    I want to plot variables (b,u) that are in function "step" .
    function main
    [t,v]=ode45('step',[0 20],0,[]);
    plot(t,v)

    function dv=step(t,v)
    c1=1;
    if t<10
    u=1;
    else
    u=-1;
    end
    dv=c1*u-2*v;
    b=dv/2;


    but these variables are unknown in function "main".
    thanks.
     
  2. jcsd
  3. Apr 15, 2010 #2
    plz help me
     
  4. Apr 15, 2010 #3
    This should solve your problem:

    Code (Text):
    doc ode45
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook