|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
本帖最后由 afflatus_999 于 2011-2-14 22:41 编辑
EMG信号滤波(50HZ notch 和10-200HZ bandpass)后,开端和末端部分的值异常,怎么解决?如图
程序如下(采样率512hz):
%% to read EMG data
rawemg=corr(1:end,1);
subplot(2,4,1)
plot(rawemg)
title('RawEMG')
xlabel('Point')
ylabel('Magnitude')
% to time-domain
leng=size(rawemg,1);
fs=512;
t=1/512:1/fs:leng/fs;
emgts=timeseries(rawemg,t);
subplot(2,4,2)
plot(emgts)
title('time-domain EMG')
xlabel('time (s)')
ylabel('magnitude')
%%notch filter
interval1=[49, 51];
emgtsfilt=idealfilter(emgts,interval1,'notch');
subplot(2,4,3)
plot(emgtsfilt)
title('notch-filtered EMG')
xlabel('time (s)')
ylabel('magnitude')
%%bandpass filter
interval2=[10,200];
emgtsfiltfilt=idealfilter(emgtsfilt,interval2,'pass');
subplot(2,4,4)
plot(emgtsfiltfilt)
title('bandpassed EMG')
xlabel('time (s)')
ylabel('magnitude')
%% filtered and rectfied EMG
filteredemg=squeeze(emgtsfiltfilt.data)';
s=abs(filteredemg);
subplot(2,4,5)
plot(s)
title('filtered and rectified EMG')
xlabel('Point')
ylabel('Magnitude')
%% to rectfy and smooth EMG
%moving average window with 500ms constant
rectemg=abs(filteredemg);
lengrect=length(rectemg);
for i=1:lengrect-256
smoothemg(i)=sum(rectemg(i:i+255))/256;
end
subplot(2,4,6)
plot(smoothemg)
title('smoothed EMG (average)')
xlabel('Point')
ylabel('Magnitude')
%moving average winodw with 2000ms constant using RMS
for i=1:lengrect-2048
smoothrmsemg(i)=sqrt(sum(rectemg(i:i+2047).*rectemg(i:i+2047))/2048);
end
subplot(2,4,7)
plot(smoothrmsemg)
title('smoothed EMG (RMS)')
xlabel('Point')
ylabel('Magnitude')
|
-
|