# Help to plot a frequency response of a function

7 views (last 30 days)

Show older comments

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 Comments

### Accepted Answer

Jon
on 5 Dec 2022

Edited: Jon
on 5 Dec 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 Comments

Jon
on 8 Dec 2022

### More Answers (0)

### See Also

### Categories

### Products

### Community Treasure Hunt

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

Start Hunting!