Help to plot a frequency response of a function
4 ビュー (過去 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!