Matlab滤除50Hz工频干扰

供参考:

https://www.mathworks.com/help/signal/ug/remove-the-60-hz-hum-from-a-signal.html

openLoop = double(data(3,:));

Fs = 1000;
t = (0:length(openLoop)-1)/Fs;
figure;
plot(t,openLoop)
ylabel('Voltage (V)')
xlabel('Time (s)')
title('Open-Loop Voltage with 60 Hz Noise')
grid

figure;
d = designfilt('bandstopiir','FilterOrder',2, ...
               'HalfPowerFrequency1',48,'HalfPowerFrequency2',52, ...
               'DesignMethod','butter','SampleRate',Fs);
fvtool(d,'Fs',Fs);
figure;

buttLoop = filtfilt(d,openLoop);

plot(t,openLoop,t,buttLoop)
ylabel('Voltage (V)')
xlabel('Time (s)')
title('Open-Loop Voltage')
legend('Unfiltered','Filtered')
grid
 

感觉巴特沃斯滤波器的参数非常不好调。

posted @ 2022-03-20 21:37  bH1pJ  阅读(624)  评论(0编辑  收藏  举报