Professional Documents
Culture Documents
Matlab Rakshit 1
Matlab Rakshit 1
MATLAB code:
w=2*pi*1
a=1
t=0:0.01:pi/2
y=a*sin(w*t)
subplot(2,2,1)
plot(y)
xlabel ('time')
ylabel ('Vr')
title ('Vr vs time')
z=(a)*sin(w*t+(pi/2))
subplot(2,2,2)
plot(z)
xlabel ('time')
ylabel ('Vl')
title ('Vl vs time')
r=a*sin(w*t-pi/2)
subplot(2,2,3)
plot(r)
xlabel ('time')
ylabel('Vc')
title ('Vc vs time')
a=1
t=0:0.01:pi/2
y=(a./re)*sin(w*t);
subplot(3,1,1)
plot(y)
xlabel ('time')
ylabel ('Current R')
title ('Ir vs time')
z=(a./(w*i))*sin(w*t-pi./2);
subplot(3,1,2)
plot(z)
xlabel ('time')
ylabel ('Current L')
title ('IL vs time')
r=(a*w*c)*sin(w*t+pi./2);
subplot(3,1,3)
plot(r)
xlabel ('time')
ylabel('Current C')
title ('Ic vs time')
RLC Series Resonance
MATLAB code:
R=input('Enter the resistance ')
L=input('Enter the Inductance ')
C=input('Enter the capacitance ')
A=input('Enter amplitude of V')
f=0:0.01:1
w=2*pi*f
xl=w*L
xc=1./w*C
z=sqrt(R.^2+(xl-xc).^2)
I=(A./z)
plot(I)
xlabel('frequency')
ylabel('Current')
title('Resonance I vs f (series)')
RLC Parallel Resonance
MATLAB code:
R=input('Enter the resistance ')
L=input('Enter the Inductance ')
C=input('Enter the capacitance ')
A=input('Enter amplitude of V')
f=0:0.01:1
w=2*pi*f
xl=w*L
xc=1./w*C
Y=sqrt(1./R.^2+(1./xl-1./xc).^2)
I=(A*Y)
plot(I)
xlabel('frequency')
ylabel('Current')
title('Resonance I vs f (parallel)')