2-D FIR filter using 2-D window method
h = fwind2(Hd, win)
h = fwind2(f1, f2, Hd, win)
fwind2 to design two-dimensional FIR
filters using the window method.
fwind2 uses a
two-dimensional window specification to design a two-dimensional FIR
filter based on the desired frequency response
with two-dimensional windows; use
fwind1 to work
with one-dimensional windows.
h = fwind2(Hd, win) produces
the two-dimensional FIR filter
h using an inverse
Fourier transform of the desired frequency response
multiplication by the window
a matrix containing the desired frequency response at equally spaced
points in the Cartesian plane.
a computational molecule, which is the appropriate form to use with
the same size as
For accurate results, use frequency points returned by
Hd. (See the entry for
h = fwind2(f1, f2, Hd, win) lets
you specify the desired frequency response
arbitrary frequencies (
along the x- and y-axes.
The frequency vectors
be in the range -1.0 to 1.0, where 1.0 corresponds to half the sampling
frequency, or π radians.
h is the same size
The input matrix
Hd can be of class
of any integer class. All other inputs to
be of class
double. All outputs are of class
This example shows how to design an approximately circularly symmetric two-dimensional bandpass filter using a 2-D window method.
Create the frequency range vectors
freqspace. These vectors have length 21.
[f1,f2] = freqspace(21,'meshgrid');
Compute the distance of each position from the center frequency.
r = sqrt(f1.^2 + f2.^2);
Create a matrix
Hd that contains the desired bandpass response. In this example, the desired passband is between 0.1 and 0.5 (normalized frequency, where 1.0 corresponds to half the sampling frequency, or
Hd = ones(21); Hd((r<0.1)|(r>0.5)) = 0;
Display the ideal bandpass response.
Create a 2-D Gaussian window using
fspecial. Normalize the window.
win = fspecial('gaussian',21,2); win = win ./ max(win(:));
Display the window.
Using the 2-D window, design the filter that best produces the desired frequency response
h = fwind2(Hd,win);
Display the actual frequency response of this filter.
an inverse Fourier transform and multiplication by the two-dimensional
 Lim, Jae S., Two-Dimensional Signal and Image Processing, Englewood Cliffs, NJ, Prentice Hall, 1990, pp. 202-213.