- #1

- 199

- 1

**matlab halp!! fplot() with 3-input argument function??**

## Homework Statement

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.

## Homework Equations

Code:

```
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
```

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: