help-octave
[Top][All Lists]
Advanced

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

leasqr question


From: Rainer
Subject: leasqr question
Date: Thu, 30 Aug 2007 13:10:04 +0200 (CEST)

Dear Colleagues

Below is a light change to the leasqrdemo to fit
my problem. But it doesnt work.
I get always the error:
"error: invalid column index = 3"
Has anybody an idea? Thanks

function leasqrtest
  % generate test data
  x = [1:0.1:100]';
  p = [1; 0.1; 150];
  data = p(1).*(p(3) - x).**(p(2));
  
%printf ("data = %f\n", data);

  F = @leasqrfunc;
  F
  
  wt1=0.1;
  
  dFdp = @leasqrdfdp; % exact derivative
  % dFdp = @dfdp;     % estimated derivative
  dp = [0.01; 0.01; 0.01];
  pin = [9; 1; 120]; 
  stol=0.001; niter=500;
  minstep = [0.0001; 0.0001; 0.001];
  maxstep = [0.5; 0.5; 0.5];
  options = [minstep, maxstep];

  global verbose;
  verbose=1;
  [f1, p1, kvg1, iter1, corp1, covp1, covr1,
stdresid1, Z1, r21] = ...
    leasqr (x, data, pin, F, stol, niter, wt1, dp,
dFdp, options);

function y = leasqrfunc(x,p)
    %y=p(1)*exp(-p(2)*x);
    p
    y=p(1).*(p(3) - x).**(p(2));
    
  endfunction

function y = leasqrdfdp(x,f,p,dp,func)
y=[(120-x).**(p(2)),p(1).*log(120-x).*(120-x).**(p(2))];
endfunction



      ________ 
Yahoo! Clever: Stellen Sie Fragen und finden Sie Antworten. Teilen Sie Ihr 
Wissen. www.yahoo.de/clever



reply via email to

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