Results 1 to 2 of 2

Math Help - Simulate System- Matlab

  1. #1
    Len
    Len is offline
    Member
    Joined
    Mar 2008
    Posts
    93
    Thanks
    1

    Simulate System- Matlab

    I'm using mathworks(Solve initial value problems for ordinary differential equations - MATLAB) to help me, I need to simulate a system, in particular this one.

    http://img849.imageshack.us/img849/4426/math3090q1.jpg

    From Example 1 on mathworks, I'm trying to convert it for my needs

    function dy = Question1(t,y)
    dy = zeros(3,1); % a column vector
    dy(1) = 1.1 * y(1) * (1 - y(1)) - y(2) * (y(1) / (1 + y(1)));
    dy(2) = y(2) * (5*(y(1) / (1+(y1)))-0.2)-y(3)*(y(2) / (1+y(2)));
    dy(3) = y(3)*(0.006 * (y(2) / (1+y(2)))-0.001);

    Saving file as Question1.m

    [T,Y] = ode45(@Question1,[0 10],[1 1.3 3.3]);
    plot(T,Y)

    but I'm getting error

    ??? Input argument "y" is undefined.

    Error in ==> Question1 at 3
    dy(1) = 1.1 * y(1) * (1 - y(1)) - y(2) * (y(1) / (1 + y(1)));
    Last edited by Len; November 23rd 2011 at 04:11 PM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4

    Re: Simulate System- Matlab

    Quote Originally Posted by Len View Post
    I'm using mathworks(Solve initial value problems for ordinary differential equations - MATLAB) to help me, I need to simulate a system, in particular this one.

    http://img849.imageshack.us/img849/4426/math3090q1.jpg

    From Example 1 on mathworks, I'm trying to convert it for my needs

    function dy = Question1(t,y)
    dy = zeros(3,1); % a column vector
    dy(1) = 1.1 * y(1) * (1 - y(1)) - y(2) * (y(1) / (1 + y(1)));
    dy(2) = y(2) * (5*(y(1) / (1+(y1)))-0.2)-y(3)*(y(2) / (1+y(2)));
    dy(3) = y(3)*(0.006 * (y(2) / (1+y(2)))-0.001);

    Saving file as Question1.m

    [T,Y] = ode45(@Question1,[0 10],[1 1.3 3.3]);
    plot(T,Y)

    but I'm getting error

    ??? Input argument "y" is undefined.

    Error in ==> Question1 at 3
    dy(1) = 1.1 * y(1) * (1 - y(1)) - y(2) * (y(1) / (1 + y(1)));
    You have a typographical error in the line dy(2)=...

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Runge-Kutta method for a system, using MATLAB
    Posted in the Differential Equations Forum
    Replies: 1
    Last Post: December 10th 2011, 02:13 AM
  2. Control system response/MATLAB
    Posted in the Advanced Applied Math Forum
    Replies: 7
    Last Post: October 13th 2009, 09:10 AM
  3. matlab uigetfile + system
    Posted in the Math Software Forum
    Replies: 0
    Last Post: January 22nd 2009, 04:23 AM
  4. MATLAB System of ODE's
    Posted in the Math Software Forum
    Replies: 0
    Last Post: September 28th 2008, 08:20 AM
  5. Best way to simulate turbulence?
    Posted in the Advanced Applied Math Forum
    Replies: 2
    Last Post: January 2nd 2007, 05:15 AM

Search Tags


/mathhelpforum @mathhelpforum