Help to plot a frequency response of a function
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Jon
2022-12-5
编辑:Jon
2022-12-5
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 个评论
Jon
2022-12-8
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time-Frequency Analysis 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!