Something I am stuck in matlab
add syms k; at the beginning
sin(k*pi/4)/(k*pi) should be sin(k*pi/4)/(k*pi+eps) to avoid division
by zero.
legned should be legend
you can't place 5 subplots in a 2x2 figure