Optimization least square approach

조회 수: 1 (최근 30일)
Galileo Pini
Galileo Pini 2021년 6월 12일
편집: Matt J 2021년 6월 12일
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 ?

답변 (1개)

Matt J
Matt J 2021년 6월 12일
편집: Matt J 2021년 6월 12일
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.

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by