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
:
我得到了错误消息“太多的输入参数”,但是输入参数的数量是正确的。下面是函数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' L1 L2];
% z=z+1;
% end
1 个解决方案
#1
6
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.
您可能有另一个文件,具有相同的名称和不同数量的参数,在路径设置的某个地方,在该文件的路径之前。因为文件被搜索到顶部,所以首先找到另一个文件,导致这个错误。
#1
6
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.
您可能有另一个文件,具有相同的名称和不同数量的参数,在路径设置的某个地方,在该文件的路径之前。因为文件被搜索到顶部,所以首先找到另一个文件,导致这个错误。