1 function [residues, ctilde, Asim, residual] = getResidues(
poles, freqData,
wSimFreqs)
2 %GETRESIDUES Determines the
residues of
a rational model fit to frequency
3 %domain
matrix (note that
this is
true VectorFitting)
4 % This
function is
for use with vector fitting. It simulates
a rational
5 % model (in adjusted partial fraction form) and determines the resdiues
6 % required to fit
a function signma(
s)
using least squares. This can then
7 % in turn be used to update the
poles of the rational model
for the next
10 % Total number of frequency points
13 % Number of
poles to use in fit
16 %Turn
this into
a matrix, with identical frequencies along the rows
19 %anorm are the complex starting/current
poles
20 %Here we create
a matrix with identical
poles down the columns
24 %Each row corresponds to
a partial fraction model at one frequency
28 %
A = [ANorm + AConj, 1j*ANorm - 1j*AConj];
30 %How many vectors are we fitting?
31 numVec = size(freqData,1)*size(freqData,2);
34 %The partial fraction expansions consits of
terms:
35 %[1/(s-a1), 1/(s-a2),..., 1, s]
36 %This is used as part of the vector fit
matrix, but also
for evaluating the
38 Asim = [Asys, ones(numFreqs,1), 1j*wSimFreqs(:)*0];
43 %Add the partial fraction
terms for the
sigma function
44 %
A = [AsimFull, -repmat(Asys,4,1).*repmat(freqDataFull,1,size(Asys,2))];
45 A = [Asim, -Asys.*repmat(freqData(:),1,size(Asys,2))];
Get residues for these Asim
Undo scaling of outgoing poles
Turn this into a with identical frequencies along the rows s
Find a complex rational model for freq domain data for a
To ensure residues come in perfect conjugate we form A as A
To ensure residues come in perfect conjugate pairs
How many vectors are we fitting numVec
Turn this into a with identical frequencies along the rows Sk
The partial fraction expansions consits of terms
Obtain iteration resiudes for model x
Number of poles to use in fit numPoles
Determine residues for sigma(s) function %ctilde
Using these poles make(s-a) terms %Each row corresponds to a partial fraction model at one frequency Asys
anorm are the complex starting current poles Here we create a matrix with identical poles down the columns P