plot function not working
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
the code for my project is as follows
A = [1.1269 -0.4940 0.1129;
1.0000 0 0;
0 1.0000 0];
B = [-0.3832;
0.5919;
0.5191];
C = [1 0 0];
Plant = ss(A,[B B],C,0,-1,'inputname',{'u' 'w'},'outputname','y');
Q = 1;
R = 1;
[kalmf,L,P,M] = kalman(Plant,Q,R);
M;
kalmf = kalmf(1,:);
a = A;
b = [B B 0*B B B 0*B B B 0*B B B 0*B B B 0*B B B 0*B B B 0*B B B 0*B B B 0*B 0*B];
c = [C;C];
d = [0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1; 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1];
P = ss(a,b,c,d,-1,'inputname',{'u' 'w' 'v' 'a1' 'a2' 'a3' 'a4' 'a5' 'a6' 'a7' 'a8' 'a9' 'b1' 'b2' 'b3' 'b4' 'b5' 'b6' 'b7' 'b8' 'b9' 'c1' 'c2' 'c3' 'c4' 'c5' 'c6' 'c7'},'outputname',{'y' 'yv'});
sys = parallel(P,kalmf,1,1,[],[]);
SimModel = feedback(sys,1,4,2,1); % Close loop around input #4 and output #2
SimModel = SimModel([1 2],[28 1 2]); % Delete yv from I/O list
SimModel.InputName;
SimModel.OutputName;
t = [1:28];
src = dsp.SignalSource('SamplesPerFrame',1);
src.Signal = xlsread('D:\ieee14\samplefault.xlsx',1,'A1:AB1');
w = src.Signal;
src1 = dsp.SignalSource('SamplesPerFrame',1);
src1.Signal = xlsread('D:\ieee14\faultset.xlsx',1,'A1:AB1');
u = src1.Signal;
src2 = dsp.SignalSource('SamplesPerFrame',1);
src2.Signal = xlsread('D:\ieee14\faultset.xlsx',1,'A5601:AB5601');
v = src2.Signal;
[out,x] = lsim(SimModel,[w;v;u]);
y = out(:,1); % true response
y = y';
ye = out(:,2); % filtered response
ye = ye';
yv = y + v; % measured response
subplot(211),plot(t,y,'--',t,ye,'-'),
ylim([-2,0.6]);
xlim([1,30]);
xlabel('No. of samples'), ylabel('Output')
title('Kalman filter response')
subplot(212), plot(t,y-yv,'-.',t,y-ye,'-'),
xlabel('No. of samples'), ylabel('Error')
i get the following output(attached)
the size of all variables t, u, v, w, x, y, ye, yv are 1x28 double
why is plot(t,y,'--') not plotting? Also i want my kalman filter to take 5061 rows and 28 columns at a time how can i do that?
Thanks in advance
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Parametric Spectral Estimation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!