Main Content

freqresp

Frequency response of rational object and rationalfit function object

Description

[response, outputfreq] = freqresp(fit,inputfreq) calculates the frequency response, response of the fit of a rationalfit function object or a rational object at the specified input frequencies, inputfreq.

example

Examples

collapse all

Create a sparameters object from a file and use rfparam to extract the S21parameters.

S = sparameters('passive.s2p');
S21 = rfparam(S,2,1);

Fit a rational function to the data by using rationalfit.

freq = S.Frequencies;
fit_data = rationalfit(freq,S21);

Compute the frequency response by using the freqresp method and plot the magnitude and angle of the frequency response.

[resp,freq] = freqresp(fit_data,freq);
plot(freq/1e9,20*log10(abs(resp)))

Figure contains an axes object. The axes object contains an object of type line.

plot(freq/1e9,unwrap(angle(resp)))

Figure contains an axes object. The axes object contains an object of type line.

Perform rational fitting on a S-parameters object by using rational object.

S = sparameters('passive.s2p');
fit_data = rational(S);

Compute the frequency response by using the freqresp function.

freq = S.Frequencies;
[resp,freq] = freqresp(fit_data,freq);

Plot the magnitude of the frequency response of the S21data.

plot(freq/1e9,20*log10(abs(squeeze(resp(2,1,:)))))
xlabel('Frequency (Hz)');
ylabel('Magnitude of Frequency Response');

Figure contains an axes object. The axes object with xlabel Frequency (Hz), ylabel Magnitude of Frequency Response contains an object of type line.

Plot the angle of the frequency response of the S21data.

plot(freq/1e9,unwrap(angle(squeeze(resp(2,1,:)))))
xlabel('Frequency (Hz)');
ylabel('Angle of Frequency Response');

Figure contains an axes object. The axes object with xlabel Frequency (Hz), ylabel Angle of Frequency Response contains an object of type line.

Input Arguments

collapse all

Rational fit object, specified as a rfmodel.rational or rational object. The size of this object is M-by-N array.

Input frequency to compute and plot the frequency response, specified as a vector of positive frequencies in Hz.

Data Types: double

Output Arguments

collapse all

Computed frequency response of each M-by-N fit, specified as a vector.

Data Types: double

Frequency values same as input frequencies, returned as a real positive vector.

Data Types: double

Version History

Introduced before R2006a