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' L1 L2];
% z=z+1;
% end