help-octave
[Top][All Lists]
Advanced

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

Lsqnonlin optimset display iter


From: hydrantomat
Subject: Lsqnonlin optimset display iter
Date: Thu, 23 Jan 2020 05:45:27 -0600 (CST)

Hello, 

I am trying to solve an ODE and to fit the resulting function to measured
data points with the lsqnonlin function. Variation of the parameter "k"
should fit the function to the data points. This works quite well. 

However the optimset function does not display the iterations via
optimset('Display','iter'). 
Is there something wrong using this function? 

Thanks in advance. 

%------------- example---------------------------- 
clear; 
% load packages 
pkg load optim 

% loading measured data 
data=[270 0 ;       
                0              5.826    ; 
                10089.25 4.618    ; 
                20510.84 3.84   ; 
                41419.94 2.91   ; 
                60000       2.4       ; 
                83734.16 2.217    ]; 
        
% data structuring 
TR_mes=270; 
t=data(2:end,1); 
ygem=data(2:end,2:end); 
y0=ygem(1,:); 


% differential equiation 
function  dxdy= dgl(t,x,k,TK) 
dxdy= -(1000 * exp (-k * 1000 / (8.3145 * (TK+273))) ) * x; 
endfunction 


% start value 
strt= 80; 

% least square solver 
function yTG=lsqnonlinear(k,t,x,ygem,TR) 
[tsim ysim]=ode23('dgl',t,x,k,TR); 
yTG= sum(abs(1-(ysim(2:end,:)./ygem(2:end,:)))); 
endfunction 

[xx]= lsqnonlin(@(k)
lsqnonlinear(k,t,y0,ygem,TR_mes),strt,[],[],optimset('Display','iter'));




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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