Plot magnitude of reflection coefficient in linear and db scale, vswr

6 views (last 30 days)
Good afternoon,
I have a hw problem that requires me to plot the reflection coefficent in linear, db scale,and vswr so far I have these lines of code.
C=8.34E-12;
L=15E-9;
zo=50;
zin=50+((1/1i*C)+1i*L);
f=linspace(200E6,1E9);
w=2*pi*f;
gamma=((zin-zo)./(zin+zo));
agamma=abs(gamma);
db=10*log10(abs(agamma)^2);
vswr=(1+agamma)/(1-agamma);
plot(db,f)
plot(w, vswr)
plot(w,gamma)
I have errors and its saying imaginary parts are ignored.

Accepted Answer

Star Strider
Star Strider on 25 Feb 2020
Edited: Star Strider on 25 Feb 2020
Use the linspace function to create the ‘f’ vector:
C=8.34E-12;
L=15E-9;
zo=50;
zin=50+((1/1i*C)+1i*L);
f=linspace(200E6,1E9);
gamma=((zin-zo)./(zin+zo));
agamma=abs(gamma);
w=2*pi*f;
figure
plot(f,agamma)
I suspect that ‘zin’ should instead be:
zin=50+(1./(1i*C)+1i*L);
and likely also needs to be a function of ‘w’. I leave that to you.
(When I made the necessary other corrections and ran your code, there appears to be a match at 450 MHz.)
EDIT — (20 Feb 2020 at 20:36)
The imaginary parts are ignored in the plot if you plot ‘gamma’. If you instead plot ‘agamma’ there is no problem.
For that reason, also use ‘agamma’ when you calculate the values in dB.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!