help-octave
[Top][All Lists]

## Help in parameter estimation

 From: Bharath R Subject: Help in parameter estimation Date: Tue, 30 Aug 2016 12:00:40 +0200

Hello Dear members,

I have the following equation which computes T(temperature)

T(i+1) = 1*[(p(1)-x(1)/(p(2)*p(3))+((p(4)*x(2)*(x(3)-x(1))+(p(5)*x(4))+(p(6)*x(5)))/p(3))+p(7)]+T(i);

p- parameters (with initial guesses)
x(vector of measured values)

I am writing a function describing the above equation which is given below:

function m=f(x,p)
m(1,:)=20;
for i=1:length(x)
m(i+1,:)=((p(1)-m(i,:))/(p(2)*p(3))+((p(4)*x(i,2)*(x(i,3)-m(i,:)))+(p(5)*x(i,4))+(p(6)*x(i,5)))/(p(3))+p(7))+m(i,:);
endfor
mat=m(2:end);
endfunction

y=measured temperature
pin=[p(1);p(2);p(3);p(4);p(5);p(6);p(7)];

Im trying to use non linear curve fit function to estimate the parameters:

[P, FY, CVG, OUTP] = nonlin_curvefit (m, pin, x, y)

when I run the program, it throws me the following error:

error: __nonlin_residmin__: subscript indices must be either positive integers less than 2^31 or logicals
error: called from
__nonlin_residmin__ at line 585 column 9
nonlin_curvefit at line 83 column 18

Could someone please help me with this? I tried running the loop without the function and Im  getting results, but when I run it within function, Im getting the aforementioned error. Im looking forward to your inputs.

Regards,
Bharat