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!