help-octave
[Top][All Lists]
Advanced

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

Newbie question related with leasqr


From: juanba romance
Subject: Newbie question related with leasqr
Date: Sun, 15 Feb 2009 19:44:03 +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'

But i can add x and samples without any trouble cause both are 7x1 ranged
Best regards..

reply via email to

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