1function dcblock_plot_transferfn(R, fs);
2% Plot the transfer function.
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
8f = linspace(1, fs/2, 500);
9
10semilogx(f, 20*log10(freqz(b, a, f, fs)));
11grid on
12xlabel('Frequency (Hz)');
13ylabel('Magnitude (dB)');
14tstr = sprintf("DC Blocking Filter Frequency Response, R = %i", R);
15title(tstr);
16
17endfunction
18