I got this error after run this program:- Improper assignment with rectangular empty matrix. Error in signal (line 2) [R_A(i), R_t(i)]=max(sigL(left(i):right(i))); please help me out
Afficher commentaires plus anciens
sig = load('NEW.m');
N = length(sig);
fs = 200;
t = [0:N-1]/fs;
figure(1);subplot(4,2,1);plot(sig);
title('Original Signal');
b = 1/32*[1 0 0 0 0 0 -2 0 0 0 0 0 1];
Warning: MATLAB has disabled some advanced graphics rendering features by switching
to software OpenGL. For more information, click here.
title('Original Signal');
b = 1/32*[1 0 0 0 0 0 -2 0 0 0 0 0 1];
a = [1 -2 1];
sigL=filter(b,a,sig);
subplot(4,2,3); plot(sigL)
title('Low Pass Filter')
subplot(4,2,4);zplane(b,a)
b = [-1/32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1/32];
a = [1 -1];
sigH = filter(b,a,sigL);
subplot(4,2,5);plot(sigH)
title('High Pass Filter')
subplot(4,2,6);zplane(b,a)
b = [1/4 1/8 0 -1/8 -1/4];
a=[1];
sigD = filter(b,a,sigH);
subplot(4,2,7);plot(sigD);
title('Derivative Base Filter')
subplot(4,2,8);zplane(b,a)
sigD2 = sigD.^2;
signorm = sigD2/max(abs(sigD2));
h = ones(1,31)/31;
sigAV = conv(signorm,h);
sigAV = sigAV(15+[1:N]);
sigAV = sigAV/max(abs(sigAV));
figure(2);plot(sigAV)
title('Moving Average Filter')
threshold = mean(sigAV);
P_G = (sigAV>0.01);
figure(3); plot(P_G);
title('Threshold Signal')
figure; plot(sigL)
difsig = diff(P_G);
left = find(difsig==1);
right = find(difsig==-1);
for i=1:length(right);
[R_A(i), R_t(i)]=max(sigL(left(i):right(i)));
R_t(i)=R_t(i)-1+left(i); %add offset
[Q_A(i), Q_t(i)]=min(sigL(left(i):R_t(i)));
Q_t(i)=Q_t(i)-1+left(i);
[S_A(i), S_t(i)]=min(sigL(left(i):right(i)));
S_t(i)=S_t(i)-1+left(i);
[P_A(i), P_t(i)]=max(sigL(left(i):Q_t(i)));
P_t(i)=P_t(i)-1+left(i);
[T_A(i), T_t(i)]=max(sigL(S_t(i):right(i)));
T_t(i)=T_t(i)-1+left(i)+47;
end
Réponses (0)
Catégories
En savoir plus sur Multirate Signal Processing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!