fir2 [signal]
usage: b = fir2(n, f, m [, grid_n [, ramp_n]] [, window])

Produce an FIR filter of order n with arbitrary frequency response,
returning the n+1 filter coefficients in b.

n: order of the filter (1 less than the length of the filter)
f: frequency at band edges
f is a vector of nondecreasing elements in [0,1]
the first element must be 0 and the last element must be 1
if elements are identical, it indicates a jump in freq. response
m: magnitude at band edges
m is a vector of length(f)
grid_n: length of ideal frequency response function
defaults to 512, should be a power of 2 bigger than n
ramp_n: transition width for jumps in filter response
defaults to grid_n/20; a wider ramp gives wider transitions
but has better stopband characteristics.
window: smoothing window
defaults to hamming(n+1) row vector
returned filter is the same shape as the smoothing window

To apply the filter, use the return vector b:
y=filter(b,1,x);
Note that plot(f,m) shows target response.

Example:
f=[0, 0.3, 0.3, 0.6, 0.6, 1]; m=[0, 0, 1, 1/2, 0, 0];
[h, w] = freqz(fir2(100,f,m));
plot(f,m,';target response;',w/pi,abs(h),';filter response;');