Optimization least square approach

1 Ansicht (letzte 30 Tage)
Galileo Pini
Galileo Pini am 12 Jun. 2021
Bearbeitet: Matt J am 12 Jun. 2021
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 ?

Antworten (1)

Matt J
Matt J am 12 Jun. 2021
Bearbeitet: Matt J am 12 Jun. 2021
Shouldn't it be
err = sum (real(error).^2) + sum(imag(error).^2) ;
If so, then this is a linear least squares problem, and you should probably just use mldivide() instead of fminsearch.

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by