www.gusucode.com > rf 案例源码程序 matlab代码 > rf/RationalfitExampleExample.m
%% Rationalfit example % %% Read the S-parameter data into an RF data object % % Copyright 2015 The MathWorks, Inc. orig_data = read(rfdata.data,'passive.s2p'); freq = orig_data.Freq; data = orig_data.S_Parameters(1,1,:); %% Fit a rational function to the data using rationalfit % fit_data = rationalfit(freq,data) %% Compute the frequency response of the rational function using freqresp % [resp,freq] = freqresp(fit_data,freq); %% Plot the magnitude of the original data against the rational function approximation % figure title('Rational fitting of S11 magnitude') plot(orig_data,'S11','dB') hold on plot(freq/1e9,20*log10(abs(resp)),'r'); %% Plot the angle of the original data against the rational function approximation % figure title('Rational fitting of S11 angle') plot(orig_data,'S11','Angle (radians)') hold on plot(freq/1e9,unwrap(angle(resp)),'r')