1 function [poles,residues,remainder,proportional] = findComplexRationalApproximation(
freqBins,freqData)
2 % This
function takes in frequency data and fits
a rational approximation
6 % Number of
poles to use in fit
9 % Scale incoming frequencies
13 % Distribute
poles evenly across
S-plane
19 % Or just use real
poles
22 % Create vector of simulation frequencies
25 % Turn
this into
a matrix, with identical frequencies along the rows
29 % Ensure
poles are stable
40 % Determine zeros (which become
new poles)
43 % Set next iteration poles equal to zeros
44 sPoleFreqs = z(:,ii).';
47 % Ensure
poles are stable
57 % Compute
residual error and print to screen
60 % Count number of useful output variables
63 % Extract these output variables
66 %Plot modelled vs actual data
Extract these output variables res
Get residues for these Asim
Get residues for these residual
Scale incoming frequencies maxFreq
Count number of useful output variables numVar
Undo scaling of outgoing poles
Undo scaling of outgoing residues
Create vector of simulation frequencies wFreqBins
Plot modelled vs actual data plot(freqBins, abs(freqData),'-x')
Turn this into a with identical frequencies along the rows s
Extract zeros Form matrix with poles on diagonal Az
Find a complex rational model for freq domain data for a
The partial fraction expansions consits of terms
end if abs(real(dotprod))>rstoerst rstoerst