%Attique Rehman.
%28395921
%Digital Signal processing.
%Proj 3.
%Presented To Tom Poonnen.

%**********The Hamming Window Project***********

%Part 1.

%Given Impulse responce Of A LowPass Filter: 
%hd(n)=sin(Wp*n)/pi*n, for n=-3,-2,-1,0,1,2,3.....

% Also Given is the Passband Cutoff Frequency denoted by wp equal to 0.4*pi.

% And wp/pi is set for n=0.

%*******************Start Of Project************

clear all;

wp=0.4*pi;
b1=0:30;                                   %Matrix Size b1
h=sin(wp*(b1-15))./(pi*(b1-15));           %The Impulse Responce Of LowPass
h(16)=wp/pi;

[H,W] = freqz(h,1,256);                    %getting the Signal Frequency Responce
mag=20*log10(abs(H));
figure(1);
subplot(1,2,1)
plot(b1,h);
title('Part 1, Plot For h(n), The Impulse respone');
xlabel('Time');
ylabel('Impulse Responce,LowPass Filter h(n)');

%******************
%Plot For H(ejw).

figure(2)
plot(W/pi,mag);
title('Part 1, Plot For The Magnitude H(ejw)');
xlabel('Frequency');
ylabel('H(ejw');

%*************

%Part 2. Designing An FIR Filter.

%The FIR Filter--------> hf(n)= h(n)w(n).
%w(n)-----> Hamming Window Defined

length(h);
wind=hamming(31);
length(wind);
ha=h*(wind);
[Ha,Wa]=freqz(h1,1,256);
mag=20*log10(abs(Ha));
figure(3);
plot(b1,ha);
title('FIR Filter Design With The Help Of Hamming Window');
xlabel('');
ylabel('');

%Part 3.

%Different Types Of Windows & Applications In Signal Processing.

%There are three types of Windows that are used in Signal Processing.

%These are Listed Below:

%1).Kaiser; Returns a filter of order n and beta parameter to specify a
				%Kaiser Window for use with the fir1 function.

%2).Hamming; Hamming(n) returns an n-point symmetric Hamming window
				 %in the column vector w. n should be a positive integer.
				 						

%3)Gaussian.


				%As far as FIR Filter is concerned, It uses a Hamming window with Length = N+1.


%**************************End Of Project 3.***************************
