help-octave
[Top][All Lists]
Advanced

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

Re: Newbie question related with leasqr


From: Francesco Potortì
Subject: Re: Newbie question related with leasqr
Date: Tue, 17 Feb 2009 12:14:53 +0100

>Hello all i am trying to fit some data on a kind of logistic curve
>but i can not find whats wrong on code below (maybe some fundamental issue).
>
>
>Can anyone provide me hints/tips about it ?
>
>*function analyzer
>
>  load data.dat
>  so_simulation = 250;
>
>  samples = data( : ,2 );
>  x = data( : ,1 );
>  partition = linspace(0, so_simulation, so_simulation );
>
>  A=2;
>  B=4000;
>  C=0.07;
>  D=1.2;
>  E=2.3;
>
>  guess = [ 2; 1.2; 4000; 2.3; 0.07 ];
>
>  func_engine = inline( "par(1) + ( par(2) / ( 1 + ( par(3) * par(4).^( -
>par(5) * x ) ) ) )", "x", "par");
>  for i=1:so_simulation
>    func_data( i ) = func_engine( partition( i ), guess );
>  end;
>
>  plot( partition, func_data, "*" );
>  global verbose;
>  verbose=1;
>
>  x
>  samples
>
>  leasqr( x, samples, guess, func_engine );
>
>  function y = func_def( x , par )
>    y = par(1) + ( par(2) / ( 1 + ( par(3) * par(4).^( - par(5) * x ) ) ) );
>*
>
>
>Octave outputs on the leasqr these messages
>x =
>
>   250
>   225
>   200
>   150
>   100
>    50
>    20
>
>samples =
>
>   3.2000
>   3.2000
>   3.0000
>   2.3000
>   2.1000
>   2.0500
>   1.9500
>
>error: operator -: nonconformant arguments (op1 is 7x1, op2 is 1x7)
>error: evaluating binary operator `-' near line 183, column 9
>error: evaluating binary operator `.*' near line 183, column 5
>error: evaluating assignment expression near line 183, column 2
>error: called from `leasqr' in file
>`/usr/share/octave/packages/optim-1.0.4/leasqr.m'
>error: called from `analyzer' in file
>`/home/umov/suinsa-svn/tomograph-analyzer/analyzer.m'

Have you looked at the place where the inpterpreter signals an error?
Apparently you used a row vector where you should have used a column
one, or the opposite.

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/


reply via email to

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