To test if you consider it worthwhile.
A simplified model of impedance magnitude and a function to fit the model parameters to measured data.
The fit seems to be not excellent but good enough to get usable Thiele-Small parameters.
function [mag] = impedance_speaker_model (f,params)
% total impedance:
Z = Rdc + w * Le + Zlow;
mag = abs (Z);
endfunction
function [Rdc,f0,Qe,Qm,Le] = impedance_fit_speaker (f,mag)
% guess starting value for Rdc:
Rdc = min (mag);
% guess starting values for f0:
u = diff (mag);
F = ( f(1:end-1) + f(2:end))/2;
[u1,k1] = max (u); [u2,k2] = min (u);
if ~exist ('f0','var')
f0 = (F(k1)+F(k2))/2;
endif
clear F
% estimate impedance at f0:
[u,k] = min(abs(f-f0));
Rmax = mag(k);
clear u
clear k
% estimate f1 and f2:
k = find(f<f0);
[u,k] = min(abs(mag(k)-sqrt(Rmax*Rdc)));
f1 = f(k);
clear u
clear k
f2 = f0^2/f1;
% guess starting values for Qe and Qm:
Qm = f0/(f2-f1)*sqrt(Rmax/Rdc);
Qe = Qm / (Rmax/Rdc-1);
To test if you consider it worthwhile. A simplified model of impedance magnitude and a function to fit the model parameters to measured data. The fit seems to be not excellent but good enough to get usable Thiele-Small parameters.
function [mag] = impedance_speaker_model (f,params)
Rdc=params(1); f0=params(2); Qe=params(3); Qm=params(4); Le=params(5);
w0 = 2pif0; w = 2pif;
% low-frequency impedance (resonance peak, LCR part): Res = Rdc*Qm/Qe; Ces = Qe/w0/Rdc; Les = 1/w0^2/Ces;
ZCes = 1./(iwCes); ZLes = iwLes; Zlow = 1 ./ ( 1/Res + 1./ZCes + 1./ZLes );
% total impedance: Z = Rdc + w * Le + Zlow; mag = abs (Z);
endfunction
function [Rdc,f0,Qe,Qm,Le] = impedance_fit_speaker (f,mag)
% guess starting value for Rdc: Rdc = min (mag);
% guess starting values for f0: u = diff (mag); F = ( f(1:end-1) + f(2:end))/2; [u1,k1] = max (u); [u2,k2] = min (u); if ~exist ('f0','var') f0 = (F(k1)+F(k2))/2; endif clear F
% estimate impedance at f0: [u,k] = min(abs(f-f0)); Rmax = mag(k); clear u clear k
% estimate f1 and f2: k = find(f<f0); [u,k] = min(abs(mag(k)-sqrt(Rmax*Rdc))); f1 = f(k); clear u clear k f2 = f0^2/f1;
% guess starting values for Qe and Qm: Qm = f0/(f2-f1)*sqrt(Rmax/Rdc); Qe = Qm / (Rmax/Rdc-1);
% starting value for Le Le = 0;
clear f1 clear f2
inputparams = [Rdc,f0,Qe,Qm,Le]; [f,p,cvg,iter,corp,covp]=leasqr(f,mag,inputparams,"impedance_speaker_model"); Rdc=p(1); f0=p(2); Qe=p(3); Qm=p(4); Le=p(5);
endfunction