% Brick wall filter
freq = 10.^(-3:0.001:3);

% Begin with a clean graphical slate...
for fig=1:6 %bodeplot creates 6 figures.
   figure(fig)
   hold off
endfor

% Define the transfer function
brickwall = freq < 1; % The classic Brick Wall!!
bodeplot(freq, brickwall, 'r')

legendtext=['brick wall'];

figure(1)
title('Gain of brick wall filter','fontsize',18)
xlabel('Frequency (Hz)','fontsize',16)
ylabel('Gain (dB)','fontsize',16)
legend(legendtext)
axis([0.01,1000,-160,2])
print('brickwallGain.pdf')
axis([0.1,10,-20,5])
print('brickwallGainZoom.pdf')

figure(2)
title('Phase of brick wall filter','fontsize',18)
xlabel('Frequency (Hz)','fontsize',16)
ylabel('Phase (degrees)','fontsize',16)
legend(legendtext)
print('brickwallPhase.pdf')

figure(3)
title('Time delay of brick wall filter','fontsize',18)
xlabel('Frequency (Hz)','fontsize',16)
ylabel('Time delay (fc = 1)','fontsize',16)
legend(legendtext)
print('brickwallTimeDelay.pdf')

figure(4)
title('Time delay vs. attenuation of brick wall filter','fontsize',18)
xlabel('Attenuation (dB)','fontsize',16)
ylabel('Time delay (s)','fontsize',16)
legend(legendtext)
axis([-3,10])
print('brickwallTimeDelay-Attenuation.pdf')

figure(5)
title('Step response of brick wall filter','fontsize',18)
xlabel('Time (s)','fontsize',16)
ylabel('Response','fontsize',16)
legend(legendtext)
axis([-6,16])
print('brickwallStepResponse.pdf')

figure(6)
title('Impulse response of brick wall filter','fontsize',18)
xlabel('Time (s)','fontsize',16)
ylabel('Response','fontsize',16)
legend(legendtext)
axis([-6,16])
print('brickwallImpulseResponse.pdf')
