main content

using 'delayfactor' parameter with rationalfit -凯发k8网页登录

this example shows how to use the 'delayfactor' parameter to improve the quality of the output of .

the rationalfit function selects a rational function that matches frequency domain data. if that data contains a significant "time delay", which would present itself as a phase shift in the frequency domain, then it might be very difficult to fit using a reasonable number of poles.

in these cases, when the input data contains a large negative slope (i.e. data with a large enough time delay), we can ask rationalfit to first remove some of the delay from the data, and then find a rational function that best fits the remaining "undelayed" data. the rationalfit function accounts for the removed delay by storing it within the 'delay' parameter of the output. by default, rationalfit does not remove any delay from the data.

first, create differential transfer function data from 4-port backplane s-parameters. next, attempt to fit the data using the default settings of the rationalfit function. lastly, use the 'delayfactor' parameter to improve the accuracy of the output of rationalfit.

create transfer function

read in the 4-port backplane s-parameter data from 'default.s4p'.

s = sparameters('default.s4p');
fourportdata = s.parameters;
freq = s.frequencies;
fourportz0 = s.impedance;

convert 4-port single ended s-parameters into 2-port differential s-parameters

diffdata = s2sdd(fourportdata);
diffz0 = 2*fourportz0;

create a transfer function from the differential 2-port data

tfdata = s2tf(diffdata,diffz0,diffz0,diffz0);

analyze output of rationalfit when using default value for 'delayfactor'

use the function to calculate the response of the output of .

defaultfit = rationalfit(freq,tfdata)
warning: achieved only -10.2 db accuracy with 48 poles, not -40.0 db.  consider specifying a larger number of poles using the 'npoles' parameter.
defaultfit = 
   rfmodel.rational with properties:
        a: [48x1 double]
        c: [48x1 double]
        d: 0
    delay: 0
     name: 'rational function'
respfreq = 0:4e6:20e9;
defaultresp = freqresp(defaultfit,respfreq);

note that the 'delay' parameter is zero (no delay removed from the data).

plot the original data vs. the default output of rationalfit.

figure
subplot(2,1,1)
tfdatadb = 20*log10(abs(tfdata));
plot(freq,tfdatadb,'.-')
hold on
plot(respfreq,20*log10(abs(defaultresp)))
hold off
xlabel('frequency (hz)')
ylabel('magnitude (db)')
defaultnpoles = numel(defaultfit.a);
defstr = ['default delayfactor (uses ',num2str(defaultnpoles),' poles)'];
title(defstr)
legend('original data','default rationalfit','location','best')
subplot(2,1,2)
tfdataphase = 180*unwrap(angle(tfdata))/pi;
plot(freq,tfdataphase,'.-')
hold on
plot(respfreq,180*unwrap(angle(defaultresp))/pi)
hold off
xlabel('frequency (hz)')
ylabel('angle (degrees)')
legend('original data','default rationalfit','location','best')

figure contains 2 axes objects. axes object 1 with title default delayfactor (uses 48 poles), xlabel frequency (hz), ylabel magnitude (db) contains 2 objects of type line. these objects represent original data, default rationalfit. axes object 2 with xlabel frequency (hz), ylabel angle (degrees) contains 2 objects of type line. these objects represent original data, default rationalfit.

note that the results when using the default settings of rationalfit are poor. because the phase of the original data has a very large negative slope, it may be possible to improve the accuracy of the rational function by using the 'delayfactor' parameter.

analyze output of rationalfit when using custom value for 'delayfactor'

'delayfactor' must be set to a value between 0 and 1. choosing which value is an exercise in trial and error. for some data sets (those whose phase has an overall upward slope), changing the value of 'delayfactor' will have no effect on the outcome.

holding all other possible parameters of rationalfit constant, 0.98 is found to create a good fit.

customfit = rationalfit(freq,tfdata,'delayfactor',0.98)
customfit = 
   rfmodel.rational with properties:
        a: [31x1 double]
        c: [31x1 double]
        d: 0
    delay: 6.5521e-09
     name: 'rational function'
customresp = freqresp(customfit,respfreq);

note that the 'delay' parameter is not zero (rationalfit removed some delay from the data).

plot the original data vs. the custom output of rationalfit.

subplot(2,1,1)
plot(freq,tfdatadb,'.-')
hold on
plot(respfreq,20*log10(abs(customresp)))
hold off
xlabel('frequency (hz)')
ylabel('magnitude (db)')
customnpoles = numel(customfit.a);
customstr = ['delayfactor = 0.98 (uses ',num2str(customnpoles),' poles)'];
title(customstr)
legend('original data','custom rationalfit','location','best')
subplot(2,1,2)
plot(freq,tfdataphase,'.-')
hold on
plot(respfreq,180*unwrap(angle(customresp))/pi)
hold off
xlabel('frequency (hz)')
ylabel('angle (degrees)')
legend('original data','custom rationalfit','location','best')

figure contains 2 axes objects. axes object 1 with title delayfactor = 0.98 (uses 31 poles), xlabel frequency (hz), ylabel magnitude (db) contains 2 objects of type line. these objects represent original data, custom rationalfit. axes object 2 with xlabel frequency (hz), ylabel angle (degrees) contains 2 objects of type line. these objects represent original data, custom rationalfit.

the rational function created by using a custom value for 'delayfactor' is much more accurate, and uses fewer poles.

related topics

网站地图