1function dcblock_plot_stepfn(R, fs); 2% Plot the step response of a DC Blocking Filter 3% For a DC Blocking filter: H(z) = (1-1/z)/(1 - R/z) 4% Therefore the coefficients are b = [1 -1], a = [1 -R] 5b = [1 -1]; 6a = [1 -R]; 7 8t=((1:0.5*fs)-1)/fs; 9plot(t, filter(b, a, ones(length(t), 1))) 10grid on 11xlabel('Samples'); 12ylabel('Amplitude'); 13tstr = sprintf("DC Blocking Filter Step Response, R = %i", R); 14title(tstr); 15 16endfunction 17