help-octave
[Top][All Lists]

## Re: Help in parameter estimation

 From: Juan Pablo Carbajal Subject: Re: Help in parameter estimation Date: Tue, 30 Aug 2016 12:52:11 +0200

```On Tue, Aug 30, 2016 at 12:00 PM, Bharath R <address@hidden> wrote:
> 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
>
> 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
>
> _______________________________________________
> Help-octave mailing list
> https://lists.gnu.org/mailman/listinfo/help-octave
>
In some of the functions you defined one of your indexes is 0 or
negative or Nan or whatever that is not an integer.
Form what you sent it is not enough to pin the problem.

Also, try to vectorize your function, and you never use variable "mat"

PS: Please do not respond to my email address. Keep this conversation
in the mailing list.

```