Subtract a gain value in dB from rfplot

10 visualizaciones (últimos 30 días)
Glenn Brigham
Glenn Brigham el 15 de Sept. de 2025
Comentada: Mathieu NOE el 19 de Sept. de 2025
I need to subtract CouplingLoss from the S12 data.
CouplingLoss = -12.0412; % [dB]
H0101=sparameters('H0101-COUPLER A.s2p');
figure(1),clf,rfplot(H0101,1,2,'dB','k')

Respuestas (1)

Mathieu NOE
Mathieu NOE el 15 de Sept. de 2025
see last section of this help : retrieve the appropriate value to the gain output.
In MATLAB, the rfplot function is used to visualize RF (radio frequency) data, such as S-parameters, reflection coefficients, or RF budget results. To access and plot data using rfplot, you typically need an RF object (e.g., S-parameter object, matching network, or RF budget object). Here's a concise guide:
1. Plotting S-Parameters
To plot S-parameters from an S-parameter object:
% Load or create an S-parameter
object s_obj = sparameters('example.s2p');
% Plot all S-parameters
rfplot(s_obj);
% Plot a specific S-parameter (e.g., S21)
rfplot(s_obj, 2, 1); % Row 2, Column 1
2. Plotting Matching Network Data
To visualize the input reflection coefficient or transducer gain of a matching network:
% Create a matching network object
mn = matchingnetwork('LoadImpedance', 50, 'SourceImpedance', 75);
% Plot reflection coefficient and transducer gain
rfplot(mn);
3. Plotting RF Budget Results
To plot RF budget results for a cascade of RF components:
% Create an RF budget object
rfobj = rfbudget(...);
% Define your RF budget
% Plot RF budget results (e.g., gain vs. frequency)
rfplot(rfobj, 'Gain');
Accessing Data
If you need to access the underlying data for further analysis, you can extract it directly from the RF object (e.g., sparameters, matchingnetwork, or rfbudget) before plotting. For example:
% Access S-parameter
data data = s_obj.Parameters; % 3D matrix of S-parameters
% Access frequencies
freq = s_obj.Frequencies;
% Access RF budget results
gain = rfobj.Gain; % Example: Gain values
This approach allows you to manipulate or analyze the data programmatically before or after plotting.
  2 comentarios
Glenn Brigham
Glenn Brigham el 15 de Sept. de 2025
Thank you for the reply.
I'd like to know how to simply subtract a number (loss) from S21 using the rfplot(s_obj,2,1) format.
Mathieu NOE
Mathieu NOE el 19 de Sept. de 2025
rfplot(s_obj,2,1) alone will do the plot but you won't get direct access to the data to do your substraction . It don't believe there is a way to pass a correction factor inside the rfplot function
so either use the code shown above to access the data of the rfplot object , or maybe as a last alternative, once you have your plot done , you may access the data from the plot axes by using this code and from there it's fairly simply to do the correction
Lines = findobj(gca, 'Type','line'); % Return Handles To All 'Line' Objects
x = Lines.XData(:); % Independent Variable (Force Column Vector With '(:)')
y = Lines.YData(:); % Dependent Variable (Force Column Vector With '(:)')
Figure_Table = table(x,y, 'VariableNames',{'X values','Y values'})
if you have saved your plot as a figure , it's simply 2 more lines :
openfig('data points.fig');
set(gcf, 'Visible','off')
Lines = findobj(gca, 'Type','line'); % Return Handles To All 'Line' Objects
x = Lines.XData(:); % Independent Variable (Force Column Vector With '(:)')
y = Lines.YData(:); % Dependent Variable (Force Column Vector With '(:)')
Figure_Table = table(x,y, 'VariableNames',{'X values','Y values'})

Iniciar sesión para comentar.

Categorías

Más información sobre Data Import and Network Parameters en Help Center y File Exchange.

Productos


Versión

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by