%% Verify the RF Amplifier Design using the RF Toolbox
% Copywrite 2010 The MathWorks, Inc.
% Dick Benson
clc
clear
% Read in the transistor s-parameter mesurements
file_name = 'mrf904_10_10a.rfa'; % this is the 8505 generated measurementfile to be read and converted
d=load(file_name,'-mat');
% f is in MHz
% convert from a mag - phase representation to complex
% pre-allocate storage for good form.
spar=complex(zeros(2,2,length(d.data.s(1,1).freq)));
% the four s-parameters are now converted to a linear complex format
for k =1:2
for l=1:2
[x,y] = dbphase2xy(d.data.s(k,l).mag(:),d.data.s(k,l).ph(:));
spar(k,l,:)= x+j*y;
end;
end;
%% create an RF circuit component from this data.
%
MRF_904 = rfckt.amplifier; % construct the object
% then set object's propeties
MRF_904.IntpType='Linear'; % define the interpolation type
Fvec=1e6*d.data.s(1,1).freq;% measurement data is in MHz
netdata = rfdata.network('Type','S_PARAMETERS','Freq',Fvec,'Data',spar)
MRF_904.NetworkData=netdata;
analyze(MRF_904,Fvec); % this step must be done!
subplot(1,2,1), smith(MRF_904,'S11','S22'); title('MRF 904 Measured S Parameters');
subplot(1,2,2), polar(MRF_904,'S21','S12'); title('MRF 904 Measured S Parameters');
%% Get the matching network LC data and attach the input output LC networks to
% the transistor
load amp_data; % pick up LC values for matching networks
% File contains: Loi Coo L1o L2o C1o C2o L1i L2i C1i C2i
% A picture is worth 1K words!
% ---L2i----L1i+Loi---Base-Collector---L2o----L1o--C1o--
% | | | | |
% Rs C2i Coo C2o Rl
% | | | | |
% ------------------------------------------------------------
% start at the load end and work backwards.
% output match
hL1o_C1o = rfckt.seriesrlc('R',0,'L',L1o,'C',C1o);
hC2o = rfckt.shuntrlc('R',inf,'L',inf,'C',C2o);
hL2o = rfckt.seriesrlc('R',0,'L',L2o,'C',inf);
hCoo = rfckt.shuntrlc('R',inf,'L',inf,'C',Coo);
% input match
hL1i_Loi_C1i = rfckt.seriesrlc('R',0,'L',L1i+Loi,'C',C1i);
hC2i = rfckt.shuntrlc('R',inf,'L',inf,'C',C2i);
hL2i = rfckt.seriesrlc('R',0,'L',L2i,'C',inf);
RF_amp = rfckt.cascade('Ckts',{hL2i,hC2i,hL1i_Loi_C1i,MRF_904,hCoo,hL2o,hC2o,hL1o_C1o});
analyze(RF_amp,[10:1:400]*1e6);
subplot(1,2,1), smith(RF_amp,'S11','S22'); title('RF Amp input / output matching ');
subplot(1,2,2), plot(RF_amp,'S21'); title('Forward gain S21');