Help to plot a frequency response of a function
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I need to plot the following S21 function:
S11= 1/(2RojωC -1)
S21 = Ro/((-1/jωC)+Ro) * (1+S11)
I then need to plot the following S21 function:
S11= -RojωC/(RojωC-2)
S21= 1+ S11
The above euqations need to have:
C = 1.5pF
Ro = 50Ω
ω = 2π*(0GHz to 20GHz)
Intervals: 0.1 GHZ
x axis = Freqency
y axis = dB
3 commentaires
Réponse acceptée
Jon
le 5 Déc 2022
Modifié(e) : Jon
le 5 Déc 2022
Here is a basic approach (not using any toolbox functions for frequency response), that might give you some ideas of how this can be done in MATLAB
% parameters
C = 1.5e-9 % [Farads]
Ro = 50 % [Ohms]
fRange = [0 20e9] % [frequency range Hz]
interval = 0.1e9 % [plotting interval]
% create vector of frequency values to be evaluated
f = fRange(1):interval:fRange(2)
% convert to radian frequency
omega = 2*pi*f;
j = 1i; % define j (just in case j is used somewhere else as an index)
% evaluate functions at each frequency (vectorized)
S11 = 1.0 ./(2*Ro*j*omega*C -1);
S21 = Ro ./((-1.0 ./(j*omega*C))+Ro) .* (1+S11);
% find the magnitude of S21 and convert to dB
dB = 20*log10(abs(S21));
% plot results
plot(f,dB)
xlabel('frequency [Hz]')
ylabel('S21 [dB]')
Here is what running this code will give you
% parameters
C = 1.5e-9 % [Farads]
Ro = 50 % [Ohms]
fRange = [0 20e9] % [frequency range Hz]
interval = 0.1e9 % [plotting interval]
% create vector of frequency values to be evaluated
f = fRange(1):interval:fRange(2)
% convert to radian frequency
omega = 2*pi*f;
j = 1i; % define j (just in case j is used somewhere else as an index)
% evaluate functions at each frequency (vectorized) note ./, .* for element
% wise operations
S11 = 1.0 ./(2*Ro*j*omega*C -1);
S21 = Ro ./((-1.0 ./(j*omega*C))+Ro) .* (1+S11);
% find the magnitude of S21 and convert to dB
dB = 20*log10(abs(S21));
% plot results
plot(f,dB)
xlabel('frequency [Hz]')
ylabel('S21 [dB]')
5 commentaires
Jon
le 8 Déc 2022
You can use semilogx for this. A quick way to see the documentation for functions is to type on the command line doc followed by the name of the command. So in this case type on the command line doc semilogx, and you will get all of the details on how to use the function.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Time-Frequency Analysis dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!