MATLAB exercise 2

Discussion in 'Programmer's Corner' started by smarch, Jul 8, 2010.

  1. smarch

    Thread Starter Active Member

    Mar 14, 2009
    52
    0
    I have attached the exercise as a JPEG to this post.
    I have so far come out with the following code

    Code ( (Unknown Language)):
    1.  
    2. [FONT=Calibri][SIZE=3]r=3.5;[/SIZE][/FONT]
    3. [FONT=Calibri][SIZE=3]X1=input('X1=');[/SIZE][/FONT]
    4. [FONT=Calibri][SIZE=3]for R = 1:100[/SIZE][/FONT]
    5. [SIZE=3][FONT=Calibri]    X1 = X1 + 1;[/FONT][/SIZE]
    6. [SIZE=3][FONT=Calibri]    X1 = r*(X1-1)*(1-(X1-1))[/FONT][/SIZE]
    7. [FONT=Calibri]endThis [/FONT]
    Is this correct? How can I change the equation to xnew and xold, I have tried but mess the thing up.
    Is there a simpler way to write this code?

    I am a beginner, would appreciate some much needed help.

    Thanks.
     
  2. smarch

    Thread Starter Active Member

    Mar 14, 2009
    52
    0
    Nevermind, I figured this one out! Please check my other one though!
     
Loading...