Exp 1
Exp 1
Report: 01
Report name: DC Electrical Circuit Simulation using MATLAB
Matlab code:
clc;
close all;
clear all;
t=0:.1:100;
x=2*pi*(50/1000);
a=200*square(t*x)
plot(a)
grid on;
Output:
Matlab code:
clc;
close all;
clear all;
t=0:.1:100;
x=2*pi*(50/1000);
a=200*sawtooth(t*x,0.5)
plot(a)
grid on;
Output:
Output:
Circuit diagram :
R L
Vs C
V
s
Figure 04: Circuit diagram of a RLC circuit to simulate voltage, current, power and power factor
Z=R+i*XL-XC
|Z|=√𝑅 2 + (𝑥𝐿 − 𝑥𝑐 )2
(𝑥𝐿 −𝑥𝑐 )
-1
|𝜃|=tan ( 𝑅 )
p.f=cos(𝜃)
Let
R=100 ohm ; L=10H ; C=10uF
Matlab code:
clc;
clear all;
close all;
f = 50;
R = 100;
L = 10;
C = 10*10^(-6);
Vs=120;
xL = 2*pi*f*L;
xC =1/(2*pi*f*C);
z = R + i*(xL - xC);
theta = atan((xL-xC)/R);
pf = cos(theta)
I=Vs/z
t=0:.1:10;
Vr=I*R
Vl=I*xL
Vc=I*xC
Pr=Vr*I
Pl=Vl*I
Pc=Vc*
t = 1:1:5;
pf = [pf pf pf pf pf];
plot(t,pf,'LINEWIDTH',3)
xlabel('Time(t)','FONTSIZE',24)
ylabel('Power Factor(pf)','FONTSIZE',24)
grid on
outputs:
pf = 0.0354
I =0.0015 - 0.0425i
Vr = 0.1504 - 4.2450i
Vl = 4.7237e+00 - 1.3336e+02i
Vc = 0.4786 -13.5124i
Pr = -0.1800 - 0.0128i
Pl = -5.6542 - 0.4010i
Pc = -0.5729 - 0.0406i