You do realise that the diagram you uploaded is the impulse responses for the ideal filters.
All you need to do is create an array with 1's and 0's at certain points of a and b.
freq = -.5:0.01:.5;
%high pass
b = 0.2;
hp = ones(1,length(freq));
hp(abs(freq)<0.2) = 0;
plot(freq,hp);
%axis([-0.6 0.6 -1 2]);
xlabel('Frequency')
ylabel('Magnitude')