Distorted time domain signal for high pass butterworth filter designed

R
Rebekah · Feb 26, 2021 · 1.9K views
Question
Distorted time domain signal for high pass butterworth filter designed using 'butter' command and filtered using 'filter' command Why does the filtered samples of my high pass filter (12th order) look distorted in the time domain when I use the 'filter' command? The filter is designed with the butter command with a very low cut-off frequency of 0.65Hz. The frequency of the  signal is 25Hz.
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 12, 2026
The butter worth filter has non-zero phase distortion characteristics which is observed in the time domain. A workaround to obtain  signals with zero-distortions would be to use the 'filtfilt' command instead. Please find the attached script which shows an example comparision between the two.

 

OriginalSamples = [ ...
		790.000000	; ...
		774.000000	; ...
		769.000000	; ...
		761.000000	; ...
		752.000000	; ...
		743.000000	; ...
		733.000000	; ...
		732.000000	; ...
		733.000000	; ...
		732.000000	; ...
		725.000000	; ...
		732.000000	; ...
		770.000000	; ...
		806.000000	; ...
		815.000000	; ...
		818.000000	; ...
		822.000000	; ...
		817.000000	; ...
		803.000000	; ...
		793.000000	; ...
		776.000000	; ...
		773.000000	; ...
		763.000000	; ...
		756.000000	; ...
		743.000000	; ...
		737.000000	; ...
		731.000000	; ...
		728.000000	; ...
		726.000000	; ...
		724.000000	; ...
		739.000000	; ...
		738.000000	; ...
		804.000000	; ...
		812.000000	; ...
		816.000000	; ...
		820.000000	; ...
		817.000000	; ...
		807.000000	; ...
		796.000000	; ...
		788.000000	; ...
		774.000000	; ...
		768.000000	; ...
		762.000000	; ...
		755.000000	; ...
		745.000000	; ...
		736.000000	; ...
		732.000000	; ...
		729.000000	; ...
		729.000000	; ...
		746.000000	; ...
		754.000000	; ...
		797.000000	; ...
		809.000000	; ...
		814.000000	; ...
		819.000000	; ...
		820.000000	; ...
		814.000000	; ...
		801.000000	; ...
		790.000000	; ...
		773.000000	; ...
		768.000000	; ...
		762.000000	; ...
		757.000000	; ...
		747.000000	; ...
		743.000000	; ...
		738.000000	; ...
		736.000000	; ...
		735.000000	; ...
		743.000000	; ...
		753.000000	; ...
		791.000000	; ...
		808.000000	; ...
		814.000000	; ...
		817.000000	; ...
		818.000000	; ...
		815.000000	; ...
		799.000000	; ...
		790.000000	; ...
		772.000000	; ...
		769.000000	; ...
		763.000000	; ...
		754.000000	; ...
		744.000000	; ...
		737.000000	; ...
		734.000000	; ...
		732.000000	; ...
		735.000000	; ...
		743.000000	; ...
		750.000000	; ...
		798.000000	; ...
		811.000000	; ...
		816.000000	; ...
		819.000000	; ...
		820.000000	; ...
		813.000000	; ...
		802.000000	; ...
		791.000000	; ...
		774.000000	; ...
		770.000000	; ...
		765.000000	; ...
		760.000000	; ...
		750.000000	; ...
		747.000000	; ...
		743.000000	; ...
		741.000000	; ...
		740.000000	; ...
		739.000000	; ...
		746.000000	; ...
		785.000000	; ...
		808.000000	; ...
		814.000000	; ...
		819.000000	; ...
		819.000000	; ...
		816.000000	; ...
		801.000000	; ...
		792.000000	; ...
		776.000000	; ...
		768.000000	; ...
		763.000000	; ...
		755.000000	; ...
		746.000000	; ...
		738.000000	; ...
		730.000000	; ...
		725.000000	; ...
		725.000000	];
  
%OriginalSamples = OriginalSamples - mean(OriginalSamples); 
[z,p,k] = butter(12,.65/12.5,'high');
[sos,g] = zp2sos(z,p,k);

HPLR2 = dfilt.df2tsos(sos,g);

Y = filtfilt(sos,g,OriginalSamples);
MYT = filter(HPLR2,OriginalSamples');

figure;
plot([OriginalSamples, Y MYT'],'*')
legend('Orig', 'using filtfilt', 'using filter')
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

Get a Free Consultation or a Sample Assignment Review!