Results 1 to 2 of 2

Math Help - Some help in matlab needed please

  1. #1
    Newbie
    Joined
    Feb 2010
    Posts
    1

    Some help in matlab needed please

    I have to write a code in Matlab simulating the following sequence :

    N(t+1)=A*(K-N(t))*N(t) where t=0,1,2,...T and N0<K

    Also I need to plot a graph of N as a function of t.

    I have started with :

    for t=1:T
    N(t+1)=A*(K-N(t))*N(t);
    end
    plot(N)

    I have no idea how to put the initial condition N(0)...what would be the correct
    code?

    Thanks
    Follow Math Help Forum on Facebook and Google+

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

    Code:
    %
    % warning untested code
    %
    T=[0,10];
    N=zeros(1,length(T));
    A=2;
    K=1;
    
    N(1)=1;
    
    for t=1:length(T)-1
      N(t+1)=A*(K-N(t))*N(t);
    end
    
    plot(T,N)
    You need to have initialised A, K and the initial value for N.

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Help needed in Syntax writing in MATLAB
    Posted in the Math Software Forum
    Replies: 4
    Last Post: March 2nd 2010, 10:49 PM
  2. More matlab help needed please
    Posted in the Math Software Forum
    Replies: 1
    Last Post: February 4th 2010, 07:33 AM
  3. Matlab Help needed
    Posted in the Math Software Forum
    Replies: 1
    Last Post: September 1st 2009, 09:33 PM
  4. Matlab-help needed
    Posted in the Math Software Forum
    Replies: 2
    Last Post: December 20th 2008, 01:39 PM
  5. MATLAB - matrice help needed
    Posted in the Math Software Forum
    Replies: 1
    Last Post: May 11th 2008, 06:01 AM

Search Tags


/mathhelpforum @mathhelpforum