and is one of the variables in that .mat file. You have to substitute your own signal, apparently ‘ChannelFirst’, for ‘openLoop’.
Question
Using code from Remove the 60 Hz Hum from a Signal. 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);
Expert Answer
Kshitij Singh
PhD Expert
Answered Aug 30, 2026
Looking at the documentation in the link, ‘openLoop’ is loaded in this line:
load openloop60hertz, openLoop = openLoopVoltage;
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →