Results 1 to 2 of 2

Math Help - Plotting convergent series

  1. #1
    Newbie
    Joined
    Jun 2010
    Posts
    9

    Plotting convergent series

    I am working with convergent series, and I need to plot each calculation of a loop, against the number of the loop. Rather than post my code in here, I thought I'd post a more basic code, and then I can re-arrange any solution to fit my code later on.

    Imagine that the loop was calculating numbers in the Fibonacci sequence, and then dividing each number by it's previous to converge on Phi.

    The following function would display each outcome as it got closer and closer to Phi (1.618)

    Code:
    clear all;
    loops=input('Loops: ');
    n1=0;
    n2=1;
    k=0;
    while (k<loops)
        r=n2/n1;
        f=n1+n2;
        display(r);
        n1=n2;
        n2=f;
        f=0;
        k=k+1;
    end
    How would I plot this, so that if the user entered 15 loops, the x-axis would have intervals of 1 and the y-values would be the outcome of each loop for 'r'?
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Jun 2010
    Posts
    9
    Sorry, I should have put it in the title: I am using MATLAB.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 2
    Last Post: May 2nd 2010, 04:25 AM
  2. Replies: 1
    Last Post: April 25th 2010, 09:46 PM
  3. Replies: 3
    Last Post: April 6th 2009, 11:03 PM
  4. Replies: 8
    Last Post: February 21st 2009, 10:16 AM
  5. Plotting fourier series approximation of F(t)
    Posted in the Calculus Forum
    Replies: 2
    Last Post: October 30th 2008, 03:56 PM

Search Tags


/mathhelpforum @mathhelpforum