Input argument "flag" is undefined.
显示 更早的评论
[EDIT: 20110610 00:29 CDT - reformat - WDR]
Hi, I,m trying to use this function but I get this error:
"Input argument "flag" is undefined".
Please help me...
function [out1,out2,out3]=func(flag,s,x,e,alpha,beta,gamma);
switch flag
case 'b';
out1=zeros(size(s));
out2=s;
case 'f';
out1=((s-x).^(1-alpha))/(1-alpha);
out2=-(s-x).^(-alpha);
out3=-alpha*(s-x).^(-alpha-1);
case 'g';
out1=gamma*x+e.*x.^beta;
out2=gamma+beta*e.*x.^(beta-1);
out3=(beta-1)*beta*e.*x.^(beta-2);
end
回答(2 个)
Oleg Komarov
2011-1-26
For those who can't read your function:
function [out1,out2,out3]=func(flag,s,x,e,alpha,beta,gamma)
switch flag
case 'b';
out1=zeros(size(s));
out2=s;
case 'f';
out1=((s-x).^(1-alpha))/(1-alpha);
out2=-(s-x).^(-alpha);
out3=-alpha*(s-x).^(-alpha-1);
case 'g'; out1=gamma*x+e.*x.^beta;
out2=gamma+beta*e.*x.^(beta-1);
out3=(beta-1)*beta*e.*x.^(beta-2);
end
If you call it w/o supplying any arguments that's the exact error you get, i.e. it won't work if you don't say what "flag,s,x,e,alpha,beta,gamma" are:
>> func
??? Input argument "flag" is undefined.
Error in ==> func at 3
switch flag
You should call it with the necessary arguments, in the case of flag = 'b':
>> func('b',1)
ans =
0
Hope it's clear.
Oleg
Julia
2011-8-10
0 个投票
I'm having a similar problem with this code, it gives the error "Input argument "x" is undefined.
Error in ==> Circulator at 11 Stationary=x;"
Can you help?
function [Correlation,shift] = Circulator(x,z) %Finds relative amp of x and z for circle data
Stationary=x; Moving=z;
kk=1; Correlation=[]; m=17; for n=0:.1:1 Correlation(kk,1)=Stationary(m,1)*Moving(m+n,1); kk=kk+1; end shift=max(Correlation);
end
1 个评论
Friedrich
2011-8-10
Sounds like you are calling Circulator(x,y) as Circulator(). So please pass arguments to your function Circulator.
类别
在 帮助中心 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!