blob: f1659eddec92183d61f41b7ab7c003e8b2835a91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
L = 0.1; // inductance of the coil in henry
t1 = [0:0.001:0.1];
t2 = [0.101:0.001:0.3];
t3 = [0.301:0.001:0.6];
t4 = [0.601:0.001:0.7];
t5 = [0.701:0.001:0.9]
//current variation as a function of time
i1 = 100*t1;
i2 = (-50*t2) + 15;
i3 = -100*sin(%pi*(t3-0.3)/0.3);
i4 = (100*t4) - 60;
i5 = (-50*t5) + 45;
t = [t1,t2,t3,t4,t5];
i = [i1,i2,i3,i4,i5];
plot(t, i)
dt = 0.001;
di = diff(i);
V = L*di/dt; //voltage drop appearing across the inductor terminals
Tv = [0:0.001:0.899];
plot(Tv, V, "green")
|