help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help in leasqr


From: Martin Kunz
Subject: Re: Help in leasqr
Date: Fri, 26 Aug 2016 16:51:07 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Am 26.08.2016 um 12:17 schrieb Bharath R:
Function:   g=@(x,p) [(p(1).*p(2).*x(:,1)+(p(3).*x(:,2))+(p(4)*p(5)))./((p(1)*p(2))+p(3))]

Elaborating on what Dmitri wrote: p(1) and p(2) appear only two times in your function and in both cases they are multiplied with each other. Replace them with a single parameter, there is no way to get the values of both of them by regression!

Substituting p(1)*p(2) with just p(1), the initial guess pin(1) by the product of the old pin(1) and pin(2) and increasing the maximum number of iterations to 50 I achieve convergence:

g=@(x,p) [(p(1).*x(:,1)+(p(3).*x(:,2))+(p(4)*p(5)))./((p(1))+p(3))]

pin=[1.0000e+001 1.0000e+003 1.0000e+002 1.0000e-002 1.0000e+003];

x = [21.33700    0.80000;...
     21.28800    0.10000;...
     20.55900   -0.80000;...
     21.21800   -1.40000;...
     20.68600   -1.70000];

y =  [19.545 19.300 19.300 19.137 19.000]';

[f, p, cvg, iter]=leasqr(x,y,pin,g,[],50)

gives

p =

  1.6789e+002
  1.0000e+003
  2.2327e+001
  3.7415e-002
  3.9387e+003

cvg =  1
iter =  30

f is indeed g calculated with the last set of parameters.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]