Fitting Impedance data file to parallel RLC circuit model using fmincon
25 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Abdullah Qaroot
am 2 Dez. 2021
Kommentiert: Mathieu NOE
am 13 Dez. 2021
Hello
I am trying to fit an impedance data file from simuation to a parallel equivalent RLC circuit model. attached is files needed to run the fmincon optimaztion command.
Please any help will be appreciated.
5 Kommentare
Star Strider
am 3 Dez. 2021
The parameter estimation or optimisation will not work with incomplete data.
I will leave you to explore this at your leisure.
Good luck, and have fun!
Akzeptierte Antwort
Mathieu NOE
am 3 Dez. 2021
hello
my attempt below - with just fminsearch (as I don't have the Optimisation Toolbox)
I refined a bit the IC by manual serach , not even sure it was needed. ...
clear all
clc
load('Y_adm.mat')
figure(1)
freq = freq*1e9; % must be GHz
Zp = 1./Yp1(:); % measured
R0 = 100;
L0 = 35e-012;
C0 = 1/(L0*(2*pi*5.85e9)^2);
x = [R0 C0 L0]; %from ADS
Zth = 1./((1./x(1)) + (1i.*2.*pi.*freq.*x(2)) - (1i./(2.*pi.*freq.*x(3))));
semilogy(freq,abs(Zp),'b',freq,abs(Zth),'r')
grid on
% curve fit using fminsearch
x = freq;
y = abs(Zp);
f = @(a,b,c,x) abs(1./((1./a) + (1i.*2.*pi.*freq.*b) - (1i./(2.*pi.*freq.*c))));
obj_fun = @(params) norm(f(params(1), params(2), params(3),x)-y);
sol = fminsearch(obj_fun, [R0,C0,L0]);
a_sol = sol(1);
b_sol = sol(2);
c_sol = sol(3);
y_fit = f(a_sol, b_sol,c_sol, x);
Rsquared = my_Rsquared_coeff(y,y_fit); % correlation coefficient
figure(2)
plot(x, y_fit, '-',x,y, 'r .', 'MarkerSize', 20)
legend('fit','data');
title(['Gaussian Fit / R² = ' num2str(Rsquared) ], 'FontSize', 15)
ylabel('Z', 'FontSize', 14)
xlabel('freq (GHz)', 'FontSize', 14)
R = a_sol
C = b_sol
L = c_sol
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Rsquared = my_Rsquared_coeff(data,data_fit)
% R2 correlation coefficient computation
% The total sum of squares
sum_of_squares = sum((data-mean(data)).^2);
% The sum of squares of residuals, also called the residual sum of squares:
sum_of_squares_of_residuals = sum((data-data_fit).^2);
% definition of the coefficient of correlation is
Rsquared = 1 - sum_of_squares_of_residuals/sum_of_squares;
end
8 Kommentare
Mathieu NOE
am 13 Dez. 2021
hello again
ok, I can see the result
but I am a bit lost by the fact that you have some many degrees of freedom (AB_amplitudes, AB_phase, dx, dy,...) and your only target is to get a directivity plot centered at 30°
seems like an overdetermined system to me...
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!