Results are out! Find what you Get quick advice or join the chat
Hey there! Sign in to join this conversationNew here? Join for free to post

Solving a System of Non-linear ODEs on Matlab

Announcements Posted on
Don't post your Personal Statement on TSR 19-11-2015
  1. Offline

    I have a system of two non-linear ODEs which I am trying to solve numerically using Matlab. I have never used Matlab for this sort of thing, so I thought I'd work through a demo that they give in the Help files. These are the two pieces of code I'm using:

    function [ dy ] = rigidtest( t,y )

    y = zeros(3,1); % a column vector
    dy(1,1) = y(2) * y(3);
    dy(2,1) = -y(1) * y(3);
    dy(3,1) = -0.51 * y(1) * y(2);

    options = odeset('RelTol',1e-4,'AbsTol',[1e-4 1e-4 1e-5]);
    [T,Y] = ode45(@rigidtest,[0 12],[0 1 1],options);

    Now according to the Matlab demo I should get some nice sine-curve-looking graphs. But I get three straight lines, with no deviation from the initial conditions. Also, my [T,Y] vector is only 41 lines long!

    Any idea what I'm doing wrong?




Submit reply


Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?
  2. this can't be left blank
    this email is already registered. Forgotten your password?
  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. By joining you agree to our Ts and Cs, privacy policy and site rules

  2. Slide to join now Processing…

Updated: March 25, 2012
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Today on TSR

Applying to uni

The latest advice and trending discussions are all here

Should junk food ads be banned?
Study resources
Quick reply
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.