1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab halp fplot() with 3-input argument function?

  1. Feb 2, 2014 #1
    matlab halp!! fplot() with 3-input argument function??

    1. The problem statement, all variables and given/known data
    heres da link: http://postimg.org/image/uqqr3q0k3/

    don't really need to look at that though. Its just a function in another file, I have to call it but it takes 3 input variables, problem with fplot is it only uses a function with one input variable (i.e. x).. and i (think??) that the function has to plot the values that is the output to the equation. so inside it after it calculates it would plot the points so I would probably the plot would already be given when I call the function..?? For the hint 'fplot' was given so I was confused. I actually solved it without use of fplot (plot instead) but here is the basic:

    with 2 input variables are constant, so only one is varying (x). which is range of numbers with step size. so here is my matlab code which i will post ni next section. also i could have done it another way, set an output for the function that would be the range of values. but there is no output at all except the plot graph, since the ? didnt ask about it.

    2. Relevant equations

    Code (Text):
    function [] = myfun3( x, m, s)
    if nargin==1
        m=2.5;
        s=0.8;
    end

    out=(1/(s*sqrt(2*pi)))*exp(0.5*((x-m)/s).^2);
    plot(out);title(['g(x) for values x=',num2str(min(x)),' to x=',num2str(max(x)), ' with step=',num2str(x(max(x))-x(max(x)-1)),', m=',num2str(m),', s=', num2str(s)]);
    end

     
    to call it i type:
    myfun3(0:0.05:5,2.5,0.8) or myfun3(0:0.05:5)

    The plot I got for this I have below, think this is right:
    http://postimg.org/image/o50e9d0tr/
     
    Last edited: Feb 2, 2014
  2. jcsd
  3. Feb 2, 2014 #2
    Bump plz..help me
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Matlab halp fplot() with 3-input argument function?
  1. MATLAB input question (Replies: 2)

Loading...