Matlab parachute

Discussion in 'Programmer's Corner' started by Bigcountry, Aug 30, 2014.

  1. Bigcountry

    Thread Starter Active Member

    Jul 4, 2008
    71
    0
    I have to create a function then execute it in the command window.

    I need to find "c" by graphic means.

    I am starting at something like this :

    a = fnval(dummy,c)
    fnval(c,dummy)
    fnval(...,'l')

    The program works if I plug in some value for "c" in the equation. I just need to figure out how to get it to use an infinite amount of values.

    thanks for any help.

    function dummy=parachute(c)
    m=68;
    g=9.81;
    t=10;
    v=45;
    dummy=-v+(g*m./c)*(1-exp(-c/m)*t);
    fplot('parachute',[0,20])

    grid on

    xlabel('c')

    ylabel('f(c)')

    end
     
  2. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,377
    494
    Why don't you define c?
    c=0:0.1:10000;

    The first value of c is zero. Then c is incremented by 0.1, so new c is 0.1. Then c is incremented again, new c is 0.2. And so on until you reach 10000. You graph will have 100,000 points.

    Hmm, I guess you don't want to divide by zero. Then you can do this:
    c=0.1:0.1:10000;
     
  3. Bigcountry

    Thread Starter Active Member

    Jul 4, 2008
    71
    0
    Thank you! I always have a hard time getting started. Now I have to figure out how to create a function to find "c" at 10 seconds on the graph. This is a good start.
     
  4. Bigcountry

    Thread Starter Active Member

    Jul 4, 2008
    71
    0
    Now I am getting an error message.

    Maximum recursion limit
    of 500 reached. Use
    set(0,'RecursionLimit',N)
    to change the limit. Be
    aware that exceeding
    your available stack
    space can crash MATLAB
    and/or your computer.
     
Loading...