summaryrefslogtreecommitdiff
path: root/887/CH3/EX3.6/3_6.sce
blob: 523556f5c0a1fd162d878b2435cf5563a1323925 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
clc
//ex3.6
L=5;      //inductance
t_1=[0:0.001:2];
t_2=[2.001:0.001:4];
t_3=[4.001:0.001:5];
t=[t_1,t_2,t_3];
//corresponding current variations
i_1=(1.5)*t_1;
i_2=0*t_2+3;
i_3=(-3*t_3)+15;
//voltage V=L*(di/dt)
V_1=L*(0*t_1+(1.5));
V_2=L*(0*t_2);
V_3=L*(0*t_3-3);
V=[V_1,V_2,V_3];
//stored energy W=1/2*L*i^2
W_1=(1/2)*L*i_1^2;
W_2=(1/2)*L*i_2^2;
W_3=(1/2)*L*i_3^2;
W=[W_1,W_2,W_3];
//power P=V*i
P_1=L*t_1*(1.5^2);
P_2=0*t_2;
P_3=-3*L*(-3*t_3+15);
P=[P_1,P_2,P_3];
subplot(221)
plot(t,V)
xtitle('voltage vs time','time in seconds','voltage in volts')
subplot(222)
plot(t,W)
xtitle('energy vs time','time in seconds','energy in joules')
subplot(223)
plot(t,P)
xtitle('power vs time','time in seconds','power in watts')