%SARA TANVIR
%DIGITAL SIGNAL PROCESSING
%PROJECT 3

%we already have the impulse response hd(n)
%hd(n)=sin(Wp*n)/pi*n

%the values of n are specified by n=-3....3


clear all;
wp=0.4*pi;              %cut off f
d1=0:30;
h=sin(wp*(d1-15)./(pi*(d1-15));
h(16)=wp/pi;

[H,W]=freqz(h,1,256);       %provided freq resp
mag=20*log10(abs(H));
figure(1);
plot(d1,h);
title('impulse resp');      %graph is plotted
xlabel('time');             %provides x label
ylabel('response');         %provides y label

%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

figure(2);                  
plot(W/pi,mag);
title('mag plot');
xlabel('time');
ylabel('H(ejw)');
%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

%an fir filter is designed here
%we have used hamming window technique to design this filter
%hamming window is defined by w(n)=hamming window

length(h);
win=(hamming31);
lenth=(win);
h1=h*(win);
[H1,W1]=freqz(h1,1,256);
mag=20*log10(abs(H1));      %function gives magnitude
figure(3);
plot(a1,h1);                %plots
xlabel('time');             %horizontal axis specified
ylabel('m');                %vertical axis specified

%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

%3b)
%3 types used

%3c)
%hamming,kaise,gaussian

%3d)
%hamming window is used

%3a)
%various windows and applications