フィルターのクリア

buttLoop error message code lifted from Matlab example 60 Hz hum

4 ビュー (過去 30 日間)
Don
Don 2015 年 10 月 19 日
コメント済み: Star Strider 2015 年 10 月 20 日
plot of filtered data looks reasonable in fig(1)
srate = input ('Enter SAMPLE RATE for this subject(check log book!): ');
ChannelFirst = data.ECG;
Fs=srate;
t =( 0:length(data.ECG)-1)/fs;
plot(t,data.ECG);
ylabel 'Voltage (V)', xlabel 'Time (s)'
title 'Open-Loop Voltage with 60 Hz Noise'
d = designfilt('bandstopiir','FilterOrder',2, ...
'HalfPowerFrequency1',59,'HalfPowerFrequency2',61, ...
'DesignMethod','butter','SampleRate',Fs);
fvtool(d,'Fs',Fs) ;
buttLoop = filtfilt(d,openLoop); ERROR THIS LINE <===========================
figure (2);
plot(t,data.ECG,t,buttLoop);
ylabel 'Voltage (V)', xlabel 'Time (s)';
title 'Open-Loop Voltage', legend('Unfiltered','Filtered');
[popen,fopen] = periodogram(data.ECG,[],[],Fs);
[pbutt,fbutt] = periodogram(buttLoop,[],[],Fs);
plot(fopen,20*log10(abs(popen)),fbutt,20*log10(abs(pbutt)),'--')
ylabel 'Power/frequency (dB/Hz)', xlabel 'Frequency (Hz)'
title 'Power Spectrum', legend('Unfiltered','Filtered')
ERROR MESSAGE:
Error in HRcodetest (line 120)
buttLoop = filtfilt(d,openLoop);
  1 件のコメント
Walter Roberson
Walter Roberson 2015 年 10 月 19 日
Please include the complete error message, everything in red.

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2015 年 10 月 19 日
Looking at the documentation in the link, ‘openLoop’ is loaded in this line:
load openloop60hertz, openLoop = openLoopVoltage;
and is one of the variables in that .mat file. You have to substitute your own signal, apparently ‘ChannelFirst’, for ‘openLoop’.
  2 件のコメント
Don
Don 2015 年 10 月 20 日
Thank you! As with my whole life with software, once you know the answer, it's obvious!
Star Strider
Star Strider 2015 年 10 月 20 日
My pleasure!
I’ve reviewed that example before, so I recognised the problem once I realised you weren’t loading the example data.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by