Professional Documents
Culture Documents
%lowpass filter
b=fir1(n,wp,y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(om/pi,m);
ylabel('Gain in dB---->');
xlabel('Frequency in rad/sec---->');
%highpass filter
b=fir1(n,wp,'high',y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(om/pi,m);
ylabel('Gain in dB---->');
xlabel('Frequency in rad/sec---->');
%bandpass filter
wn=[wp ws];
b=fir1(n,wn,y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);
plot(om/pi,m);
ylabel('Gain in dB---->');
xlabel('Frequency in rad/sec---->');
%bandstop filter
b=fir1(n,wn,'stop',y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(om/pi,m);
ylabel('Gain in dB---->');
xlabel('Frequency in rad/sec---->');
OUTPUT
n=
26
RESULT
Thus the matlab program to design a FIR filter using hamming window
was written and the output was verified.
In signal processing, a window function (also known as an apodization
function or tapering function[1]) is a mathematical function that is zero-
valued outside of some chosen interval. For instance, a function that is
constant inside the interval and zero elsewhere is called a rectangular
window, which describes the shape of its graphical representation. When
another function or a signal (data) is multiplied by a window function, the
product is also zero-valued outside the interval: all that is left is the part
where they overlap; the "view through the window". Applications of
window functions include spectral analysis, filter design, and
beamforming.
A more general definition of window functions does not require them to
be identically zero outside an interval, as long as the product of the
window multiplied by its argument is square integrable, that is, that the
function goes sufficiently rapidly toward zero.[2]
In typical applications, the window functions used are non-negative
smooth "bell-shaped" curves,[3] though rectangle and triangle functions
and other functions are sometimes used.
Applications
Filter design
[note 1]
Note that:
Hamming
The Hamming window is a modified version of the Hanning window.
The shape of the Hamming window is similar to that of a cosine wave. The
following equation defines the Hamming window.
(
D)
for n = 0, 1, 2, …, N – 1
where N is the length of the window and w is the window value.
The following front panel shows a Hamming window with N = 32.