1 | %close all |
---|
2 | itload('../../mpf_u_delta_real.it') |
---|
3 | figure(1); |
---|
4 | for i =1:4 |
---|
5 | subplot(4,1,i) |
---|
6 | hold off |
---|
7 | plot(xth(:,i)') |
---|
8 | end |
---|
9 | |
---|
10 | figure(2) |
---|
11 | for i=1:4 |
---|
12 | subplot(4,1,i) |
---|
13 | hold off |
---|
14 | plot(xth(:,i)') |
---|
15 | hold on; |
---|
16 | plot(xthE(:,i)','r') |
---|
17 | plot(xthM(:,i+2)','g') |
---|
18 | % plot(xthV(i,:)','m'); |
---|
19 | grid on |
---|
20 | end |
---|
21 | |
---|
22 | |
---|
23 | figure(3) |
---|
24 | tm=[1:8000]*125e-6; |
---|
25 | subplot(1,1,1) |
---|
26 | hold off |
---|
27 | plot(tm,xthM(:,1),':') |
---|
28 | hold on |
---|
29 | plot(tm,xthM(:,2),'-') |
---|
30 | set(gca,'XLim',[0,1.2]); |
---|
31 | set(gca,'YLim',[-5,5]); |
---|
32 | %set(gca,'XTick',[]); |
---|
33 | xlabel(['time [s]']); |
---|
34 | ylabel(['Estimated \Delta u [V]']); |
---|
35 | legend('\Delta u_{\alpha s}', '\Delta u_{\beta s}') |
---|
36 | |
---|
37 | if 0 |
---|
38 | subplot(2,1,2) |
---|
39 | hold off |
---|
40 | %plot(tm,-Dt(:,3)+Dt(:,5),':') |
---|
41 | hold on |
---|
42 | %plot(tm,-Dt(:,4)+Dt(:,6),'-') |
---|
43 | set(gca,'XLim',[0,1.2]); |
---|
44 | set(gca,'YLim',[-5,5]); |
---|
45 | legend('\Delta u_{\alpha s}', '\Delta u_{\beta s}') |
---|
46 | ylabel(['Simulated \Delta u [V]']); |
---|
47 | xlabel(['time [s]']); |
---|
48 | % plot(Qtr(:,i)','--') |
---|
49 | end |
---|
50 | |
---|
51 | figure(4) |
---|
52 | subplot(2,1,1) |
---|
53 | hold off |
---|
54 | di =xthE(:,1+2)'-xth(:,1+2)'; |
---|
55 | plot(tm,di,'--') |
---|
56 | MSE_E=di*di'/8000 |
---|
57 | |
---|
58 | hold on; |
---|
59 | di = xthM(:,1+4)'-xth(:,1+2)'; |
---|
60 | plot(tm,di,'-') |
---|
61 | MSE_M=di*di'/8000 |
---|
62 | plot(tm, zeros(1,8000),':') |
---|
63 | set(gca,'XLim',[0,1.2]); |
---|
64 | title ('Estimate deviation') |
---|
65 | ylabel('Rotor speed \omega') |
---|
66 | legend('EKF', 'EKF with estimated voltage drops') |
---|
67 | |
---|
68 | subplot(2,1,2) |
---|
69 | hold off |
---|
70 | di = xthE(:,2+2)'-xth(:,2+2)'; |
---|
71 | i2=find(di>1.5*pi); |
---|
72 | di(i2)=di(i2)-2*pi; |
---|
73 | i2=find(di<-1.5*pi); |
---|
74 | di(i2)=di(i2)+2*pi; |
---|
75 | plot(tm,di,'--') |
---|
76 | MSE_E=di*di'/8000 |
---|
77 | |
---|
78 | hold on; |
---|
79 | di =xthMTh' - xth(:,2+2)'; |
---|
80 | i2=find(di>1.5*pi); |
---|
81 | di(i2)=di(i2)-2*pi; |
---|
82 | i2=find(di<-1.5*pi); |
---|
83 | di(i2)=di(i2)+2*pi; |
---|
84 | plot(tm,di,'-') |
---|
85 | MSE_M=di*di'/8000 |
---|
86 | plot(tm,zeros(size(tm)),':') |
---|
87 | title ('Estimate deviation') |
---|
88 | ylabel('Rotor position \vartheta') |
---|
89 | set(gca,'XLim',[0,1.2]); |
---|
90 | %set(gca,'YLim',[-0.5 0.5]) |
---|
91 | legend('EKF', 'EKF with estimated voltage drops') |
---|
92 | |
---|
93 | % figure(3) |
---|
94 | % ndat = size(ll,2); |
---|
95 | % hold off |
---|
96 | % plot(llgrid,ll(:,floor(ndat/3)),':'); |
---|
97 | % hold on |
---|
98 | % plot(llgrid,ll(:,floor(2*ndat/3)),'--'); |
---|
99 | % plot(llgrid,ll(:,ndat)); |
---|