help-octave
[Top][All Lists]
Advanced

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

[leasqr] about setting an external parameter of F that is not part of Pi


From: [gRO] Administrateur
Subject: [leasqr] about setting an external parameter of F that is not part of Pin vector
Date: Wed, 30 May 2007 10:07:02 +0200 (CEST)

Hi,

I would like to know how to set a parameter in the F(x,p) fonction given in parameter to leasqr() that as not to be ajusted by LM algorithm...

Maybe it should be clearer with a code sample :
Code :
%parameter to be used in F(x,p,EQF) equation
EQF = Y{i}(1) - Y{i}(end);
%pins vector (initializations)
per = p;
%link to F
F = @func;
%leasqr
[f, p, kvg, iter, corp, covp, covr, stdresid, Z, r2] = ...
leasqr(X2,Y{i},per,F);

%called function as i wish to run
function y = func(x,p,EQF)
y = EQF*exp(p(1))*exp(p(2)*x)+p(3);
This obviously doesn't work.
I've also tryed to make EQF a global variable, but it doesn't work either.
Matlab give a solution by using get/setappdata :

EQF = Y{i}(1) - Y{i}(end);
setappdata(0,'EQF',EQF);
%..........
%

%called function
function y = func(x,p)
EQF=getappdata(0,'EQF');
y = EQF*exp(p(1))*exp(p(2)*x)+p(3);

Theses functions are not implemented on Octave, and i'm open to all alternatives that can be done to make this thing work,

Thanks!
Giansolo


Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
reply via email to

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