rationalfit - Fit rational function to broadband data

Syntax

h = rationalfit(freq,data)
h = rationalfit(freq,data,tol,weight,delayfactor,diszero,npoles)

Description

h = rationalfit(freq,data) fits a rational function model of the form

to the complex vector of passive values in data over the corresponding frequency values in the positive vector freq. The function returns a handle to the rational function model object, h, whose properties, A, C, D, and Delay, are shown in the preceding equation.

h = rationalfit(freq,data,tol,weight,delayfactor,diszero,npoles) fits a rational function to the data using the optional arguments tol, weight, delayfactor, diszero, and npoles that control the data fitting.

tol is a scalar that specifies the relative error-fitting tolerance, in decibels. The relative error of the fit is computed as , where fitdata is a vector containing the dependent values of the fit data. The default tolerance is -10 dB. If the model does not fit the original data to within the specified tolerance, a warning message appears.

weight is a vector that specifies the weighting of the fit at each frequency. You can increase the weight at a particular frequency to improve the model fitting at that frequency. The length of weight must be equal to the length of freq. The weight vector is empty by default.

delayfactor is a scaling factor between 0 and 1 that controls the amount of delay used to fit the data. The Delay used to fit the model to the data is delayfactor times the ratio of the phase difference of the data across the specified frequencies to the difference between the maximum and minimum frequencies. The default value is 0. This value guarantees that no fitting accuracy is lost due to overestimating the delay. However, you may be able to fit the data accurately with a lower-order model (i.e., a model with fewer poles) by increasing delayfactor.

diszero is a Boolean value that specifies whether the constant term D in the preceding equation is zero or nonzero. A value of 1 indicates that D is zero. A value of 0 indicates that D is nonzero. The default value of 1 is appropriate for almost every set of data. However, if you are having trouble fitting the data after adjusting the other control arguments, you should change the value of diszero.

npoles is an even integer or a two-element vector [M,N] of even integers.

Specifying npoles can speed up the fitting process because rationalfit does not spend time trying to fit a model with an unreasonably small number of poles to the data. As a rule of thumb, you should specify a value of npoles greater than or equal to twice the number of peaks that can be readily observed by plotting the data in the frequency domain. The default is [4, MAX], where MAX is either one quarter the number of frequency samples or 256, whichever is smaller.

To see how well the model fits the original data, use the freqresp function to compute the frequency response of the model. Then, plot the original data and the frequency response of the rational function model. See the freqresp reference page or the examples in the next section for more information.

Examples

The following example shows how to fit a rational function model to data from the passive.s2p file and how to generate plots that compare the frequency response of the original data to that of the fit data.

orig_data = read(rfdata.data,'passive.s2p')
freq = orig_data.Freq;
data = orig_data.S_Parameters(1,1,:);
fit_data = rationalfit(freq,data)
[resp,freq] = freqresp(fit_data,freq);

plot(orig_data,'S11','dB');
hold on
plot(freq/1e9,db(resp));

figure

plot(orig_data,'S11','Angle (radians)');
hold on
plot(freq/1e9,unwrap(angle(resp)));

References

B. Gustavsen and A. Semlyen, "Rational approximation of frequency domain responses by vector fitting," IEEE Trans. Power Delivery, Vol. 14, No. 3, pp. 1052–1061, July 1999.

R. Zeng and J. Sinsky, "Modified Rational Function Modeling Technique for High Speed Circuits," IEEE MTT-S Int. Microwave Symp. Dig., San Francisco, CA, June 11–16, 2006.

See Also

freqresp
rfmodel.rational
s2tf
timeresp
writeva

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS