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

조회 수: 54(최근 30일)
Nicholas Barker 25 Feb 2020
댓글: Star Strider 28 Feb 2020
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.

댓글을 달려면 로그인하십시오.

### 채택된 답변

Star Strider 25 Feb 2020
편집: Star Strider 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.

#### 댓글 수: 2

Nicholas Barker 28 Feb 2020
Much appreciated, I got all graphs figured out and found resonant frequency
Star Strider 28 Feb 2020
As always, my pleasure!

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

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

Start Hunting!

Translated by