开发者

Too many input arguments in MATLAB

When I run the following code:

xdata2 = [1 3 4 5];
ydata2 = [3 9 76 73];
params = [0.1 0.5 0.0 -0.5 0.2 0.8];
y = svenssontest2(xdata2,ydata2,params,0.636,1.9632);

I get the error message "Too many input arguments", but the number of input arguments is correct. Here's the code for the function svenssontest2:

function [alpha L1 L2] = svenssontest2(tau,Y,params,L1,L2)

tau=tau.';
Y=Y.';

nObs=length(Y);

%z=1;

%for(j =1:50)

    %L2=j/200+0.01;

    %for(k=1:50)

     %   L1=k/200+0.01;

        Lev1= [params(1)*ones(nObs,1) params(2)*(1-exp(-params(5).*tau))./(params(5).*tau) params(3)*((1-exp(-params(5).*tau))./(params(5).*tau)-exp(-params(5).*tau)) params(4)*((1-exp(-params(6).*tau))./(params(6).*tau)-exp(-params(6).*tau))];

        Y=Y-Lev1;

        G= [ones(nObs,1) (1-exp(-L1.*tau))./(L1.*tau) (1-exp(-L1.*tau))./(L1.*tau)-exp(-L1.*tau) (1-exp(-L2.*tau))./(L2.*tau)-exp(-L2.*tau)];

        alpha =G\Y;
        u=Y-G*alpha
        stderr=sqrt(diag((u'*u)/(length(Y)-4)*pinv(G'*G)));
        Sum_u2 = sum(u.^2);
        Res(1,:) = [Sum_u2 alpha' L开发者_开发问答1 L2];
    %   z=z+1;

   % end


You probably have another file, with the same name and different number of arguments, somewhere in your Path settings, before the Path of this file. Because files are searched top down, the other file is found first, causing this error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜