Optimization least square approach
1 次查看(过去 30 天)
显示 更早的评论
Hi everybody
I'm trying to find the optimum value of a vector of parameters to approximate an experimental set of data starting from a simplified vector x_0
x_0= [0.13084 ; 0 ; 0; 0; 0; 0 ]
par=fminsearch(@(par)errHjk(par,frq_redHjk,csi_i,w0i,Hjk_red_exp),x_0,options);
where has been defined the fun :
function err = errHjk(par, frq_redHjk,csi_i,w0i, Hjk_red_exp)
Aj=par(1,1);
Bj=par(2,1);
Cj=par(3,1);
Dj=par(4,1);
Ej=par(5,1);
Fj=par(6,1);
omega_red= frq_redHjk*2*pi;
Hjki=(Aj+1i*Bj)./(-omega_red.^2+2i*w0i*csi_i+w0i^2) + Cj+1i*Dj +(Ej+1i*Fj)./omega_red.^2 ;
%Output the error
error= (Hjki-Hjk_red_exp);
err = sum (real(error.^2)) + sum(imag(error.^2)) ;
end
instead of find the minimum value the error found by the program continues to increase
Do you know what is wrong with this code ?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!