Plotting S parameters in Matlab

25 views (last 30 days)
John
John on 6 Mar 2021
Answered: Rishav on 15 May 2024
Hi. So I'm trying to plot S parameters of a system. I need to plot S11 and S21 and have equations for both (derived from network synthesis data). Now my question is:
1) should I use
sparameters(S11,f)
command if the equation for S11 that I have in the code already defines it as S parameter?
S11(1,x)=1+2*i*Rs*inv(A(1,1));
A changes with frequency, and my code is designed such that every value of A(1,1) yeilds a different S11 parameter and that is stored in location (1,x) with x increasing with each cycle (x=x+1).
2) I'm not getting the right curve with or without using the sparameters command. Also rfplot and plot yield the same incorrect curve. Should S11 be in dB?

Answers (1)

Rishav
Rishav on 15 May 2024
Hi John,
The 'sparameters' command in MATLAB is typically used to create an S-parameters object from S-parameter data, usually read from a file or directly measured. If you already have an equation that defines S11 as a function of frequency and other parameters ('A' in your case), you do not need to use the 'sparameters' command to define S11.
Given your explanation, it seems you are already calculating S11 correctly across different frequencies. The key is to ensure that A(1,1) changes with frequency as intended and that you correctly iterate over 'x' to store each computed S11 value.
If the curve you are getting is not correct, please check the following pointers:
  • Frequency Range and Step: Ensure that the frequency range and step size are correctly defined. Plotting over a very narrow range or using an incorrect step size can lead to misleading results.
  • Equation Accuracy: Double-check the equation for S11 to ensure it is correctly implemented in your code. A small error in the equation or its implementation can lead to significant discrepancies in the plot.
  • Plotting in dB: To convert S11 to dB, you can use the formula 20*log10(|S11|). If S11 is complex, ensure to use the magnitude of S11 in the conversion:
S11_dB = 20*log10(abs(S11));
Then, plot 'S11_dB' against your frequency range.
  • Plotting Method: If 'rfplot' and 'plot' yield the same incorrect curve, the issue likely lies in the data being plotted, not the plotting function itself. Ensure that the data passed to these functions is correct.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!