Hi Nicholas,
Thanks for the mail. I am sorry that I have used mat earlier, now I changed the function as follows:
function F=f(x,p)
A=xlsread('OGparameters.xlsx');
x=[A(:,3),A(:,5),A(:,2),A(:,6),A(:,7)];
p(1)=20;
p(2)=1;
p(3)=100;
p(4)=1;
p(5)=0.001;
p(6)=1;
p(7)=0.01;
typeinfo(x)
pin=[p(1);p(2);p(3);p(4);p(5);p(6);p(7)];
m(1,1)=20;
for i=1:length(x)
m(i+1,1)=((p(1)-m(i,1))/(p(2)*p(3))+((p(4)*x(i,2)*(x(i,3)-m(i,1)))+(p(5)*x(i,4))+(p(6)*x(i,5)))/(p(3))+p(7))+m(i,1);
endfor
F=m(2:end);
endfunction
I am generating a matrix of [length(x), 1] as output from the function. My measured value is also a matrix of [length(x), 1].
What I would like to do now is to estimate parameters p. I am using the following command to run the optimization program ( I have tried with nonlinear curve fit as well):
[L,p,cvg,iter]=leasqr(x,y,pin,f)
pin ,x and y are initialized. The problem is when I run the optimization algorithm, it throws me the following error:
error: leasqr: subscript indices must be either positive integers less than 2^31 or logicals
error: called from
leasqr at line 329 column 9
I look forward to your reply.
Regards,
Bharath