-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRCA_V4.m
101 lines (80 loc) · 3.26 KB
/
RCA_V4.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
% Build a cascade (row vector) of RF elements
elements(1) = seriesRLC( ...
'R',18, ...
'C',1.001e-07);
elements(2) = amplifier( ...
Name='ADL5611', ...
FileName='elem_2_20240923T191840.s2p', ...
UseNetworkData=true);
elements(3) = seriesRLC('C',1e-07);
elements(4) = nport('C:\Users\jonel\OneDrive\Desktop\FFS RA6500\RA6500 RF Countermeasure\GP2X.s2p');
elements(5) = rfelement( ...
Name='GP2X', ...
Gain=-3, ...
NF=0.5, ...
OIP3=40);
elements(6) = seriesRLC('C',1e-07);
elements(7) = amplifier( ...
Name='HMC326', ...
FileName='elem_7_20240923T191840.s2p', ...
UseNetworkData=true);
elements(8) = shuntRLC('C',7e-13);
elements(9) = seriesRLC('C',3e-12);
elements(10) = shuntRLC('L',5.6e-08);
% Construct an rfbudget object
b = rfbudget( ...
Elements=elements, ...
InputFrequency=4.4e9, ...
AvailableInputPower=-30, ...
SignalBandwidth=45e6, ...
Solver='Friis', ...
AutoUpdate=false);
% Plot S-parameters for amp1
figure;
rfplot(s_params_amp1);
title('S-parameters of ADL5611 Amplifier');
% Plot S-parameters for driver
figure;
rfplot(s_params_amp2);
title('S-parameters of HMC326 Amplifier');
% Calculate and display impedance for each element
z_amp1 = s2z(s_params_amp1.Parameters);
z_driver = s2z(s_params_amp2.Parameters);
% Find the closest frequency index
[~, freq_index_amp1] = min(abs(s_params_amp1.Frequencies - freq));
[~, freq_index_driver] = min(abs(s_params_amp2.Frequencies - freq));
% Extract impedance at the closest frequency
z_amp1_at_freq = z_amp1(:,:,freq_index_amp1);
z_driver_at_freq = z_driver(:,:,freq_index_driver);
% Display impedance values
fprintf('Impedance of ADL5611 at %.2f GHz: %.2f + %.2fj Ohms\n', freq/1e9, real(z_amp1_at_freq(1,1)), imag(z_amp1_at_freq(1,1)));
fprintf('Impedance of HMC326 at %.2f GHz: %.2f + %.2fj Ohms\n', freq/1e9, real(z_driver_at_freq(1,1)), imag(z_driver_at_freq(1,1)));
%%%%%%%
% Define the frequency range for S-parameter calculations
freq = linspace(4.3e9, 4.5e9, 101); % Example frequency range from 4.3 GHz to 4.5 GHz
% Initialize the overall S-parameters with the first element
overall_sparams = sparameters(elements(1), freq);
% Cascade the S-parameters of each element
for k = 2:length(elements)
element_sparams = sparameters(elements(k), freq);
overall_sparams = cascadesparams(overall_sparams, element_sparams);
end
% Extract numeric S-parameter values
s_params_numeric = overall_sparams.Parameters;
% Plot the overall S-parameters
figure;
rfplot(overall_sparams);
title('Overall S-parameters of the RF Cascade');
% Convert S-parameters to Z-parameters
z_params = s2z(s_params_numeric, 50); % Assuming a reference impedance of 50 ohms
% Calculate the total output impedance at the output port
z_out = z_params(2,2,:);
% Display the total output impedance at a specific frequency
target_freq = 4.4e9; % Example target frequency
[~, freq_index] = min(abs(overall_sparams.Frequencies - target_freq));
z_out_at_freq = z_out(:,:,freq_index);
fprintf('Total Output Impedance at %.2f GHz: %.2f + %.2fj Ohms\n', target_freq/1e9, real(z_out_at_freq), imag(z_out_at_freq));
% Display the overall S-parameters at the specific frequency
sparams_at_freq = s_params_numeric(:,:,freq_index);
fprintf('Overall S-parameters at %.2f GHz:\n', target_freq/1e9);
disp(sparams_at_freq);