How to plot this function?
1 次查看（过去 30 天）
I have a function that is "vectorized". I did that because I wanted to have one such function for each value of the parameter "a":
p = @(x) 1/3.*(exp(x.^(a))-1)./(exp(x.^(a))+1) ;
I want to have the three plots (one for each value of "a") in the same figure. However, I am having trouble isolating each function for plotting. For instance, I expected that:
p1 = @(x) p(x,1,1)
would represent one of functions, but it doesn't. My other attempts have also failed. How can I get the desired result?
Star Strider 2014-12-24
编辑：Star Strider 2014-12-24
The easiest way is to pass ‘a’ as a parameter as well:
p = @(x,a) 1/3.*(exp(x.^(a))-1)./(exp(x.^(a))+1) ;
p1 = p(x,a(1));
Not that within the function, ‘a’ is whatever you want it to be. If you define it as a parameter, it will not pick up the value of ‘a’ from the workspace.