Help to plot a frequency response of a function
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jimi Cunningham
el 5 de Dic. de 2022
Comentada: Jon
el 8 de Dic. de 2022
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 comentarios
Respuesta aceptada
Jon
el 5 de Dic. de 2022
Editada: Jon
el 5 de Dic. de 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 comentarios
Jon
el 8 de Dic. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Time-Frequency Analysis en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!