-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperformance.m
More file actions
67 lines (40 loc) · 810 Bytes
/
Copy pathperformance.m
File metadata and controls
67 lines (40 loc) · 810 Bytes
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
iref=
imeas=
time =
pwm =
n = length(iref);
energy = 0;
plotEnergy = zeros(1, n-1);
for i=2:1:n
energy = energy + pwm(i-1)*0.01; %*(time(i)-time(i-1))
plotEnergy(i-1) = energy;
end
disp(energy);
Cerror = 0;
plotCerror = zeros(1, n);
for i=1:1:n
Cerror= Cerror+max(iref(i)-imeas(i), 0);
plotCerror(i) = (1/i) * Cerror;
end
disp(plotCerror(n));
cflicker = 0;
plotFlicker = zeros(1, n-2);
for i=3:1:n
l1 = imeas(i);
l2 = imeas(i-1);
l3 = imeas(i-2);
if (l1-l2)*(l2-l3) < 0
fi = (abs(l1-l2)+abs(l2-l3))/(2*0.01);
else
fi = 0;
end
cflicker = (1/i)*fi;
plotFlicker(i-2)= cflicker;
end
t = 1:0.01:n;
figure(1);
plot(t(1:n-1),plotEnergy);
figure(2);
plot(t, plotCerror);
figure(3);
plot(t(1:n-2), plotFlicker);