- #1

Fatima Hasan

- 319

- 14

- Homework Statement
- The question is attached below.

- Relevant Equations
- -

The plot of part b is attached below.

I got a warning on part a , I don't know where is my mistake .

Please check my work .

Part A

I got a warning on part a , I don't know where is my mistake .

Please check my work .

Part A

Matlab:

```
clc;
clear all;
%parta
f=800;
t=0:10e-6:0.005;
xc=10^(-6);
xl=40e-3;
for i=1:(0.005)/(10e-6)
w=2*f*pi;
zeq=xl*j*w+50;
is(i)=2*(1600*t(i)*pi);
c=1/(xc*j*w);
i1(i)=is(i)*c/(c+zeq); %apply CDR
vo(i)=i1(i)*zeq;
end
figure (1)
subplot(2,1,1) , plot (t,vo)
subplot (2,1,2) , plot (t,is)
%partb
f=10:10:1000;
xl=40e-3;
xc=1e-6;
r=50;
for i=1:100 %(1000-10)/10+1=100
w(i)=2*f(i)*pi;
zeq(i)=xl*j*w(i)+r;
c(i)=1/(xc*j*w(i));
l(i)=xl*w(i)*j;
zeq(i)=r+l(i);
zt(i)=zeq(i)+c(i);
is(i)=2*(cosd(0)+sind(0)*j); %convert to recantgular form
vo(i)=(is(i)*c(i)/zt(i))*zeq(i); %Apply CDR to find the current and multiply it by Zeq to get the voltage
end
logscale1=20*log(abs(vo));
logscale2=20*(log(rad2deg(angle(vo))));
subplot(2,1,1) , plot(f,logscale1)
subplot(2,1,2) , plot(f,logscale2)
```