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

MATLAB help-ode45

  1. Aug 26, 2011 #1

    I am trying to write a program on matlab using ode45 to solve the following equations:


    These are all derivatives with respect to t, differential equations.

    a, b, a and g are all constants.

    I realise I need to have two m files, one which defines the functions, and one which calls that and uses ode45. The code for my first m file is:

    function Yout = program1(S,Z,R);

    global beta gamma alpha sigma;

    % set the parmeter values
    tend = 10;
    S0 = 500;
    I0 = 1;
    a= 0.005;




    udot = [Sdot; Zdot; Rdot];

    I'm not sure if that is suitable, and I also need help writing the second m file. I need to plot Z and R on the same plot, vs t. I am really stuck, I have been working for hours, looking at examples, trying different combinations. MATLAB is most definitely not my strong point.

    Thanks for the help!
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted

Similar Discussions: MATLAB help-ode45
  1. Matlab ODE45 Help? (Replies: 4)

  2. Matlab ode45 (Replies: 7)