FIR Filter



Modules: where, for gr.fir_filter_IOT, I and O can be any of c (complex), f (float) and s (short) for input and output data type, and T can be c (complex) or f (float) for the filter taps. gr.fir_filter_IOT takes two parameters, for example:
	gr.fir_filter_fff (  \
		int decimation,
		vector<float> taps )
for float in, float out with float taps.

Valid filter TYPEs are

The parameters for each filter type are:

	gr.firdes.low_pass (  \
		double gain,
		double sampling_freq,
		double cutoff_freq,		// Hz center of transition band
		double transition_width, 	// Hz width of transition band
		win_type WINDOW )


Note that transition_width determins the number of taps required. Narrow widths require more taps, and hence more CPU usage.
WINDOW determins maximum attenuation and passband ripple, and can be any of

	gr.firdes.high_pass (  \
		double gain,
		double sampling_freq,
		double cutoff_freq,		// Hz center of transition band
		double transition_width,	// Hz width of transition band
		win_type WINDOW )


	gr.firdes.band_pass (  \
		double gain,
		double sampling_freq,
		double low_cutoff_freq,		// Hz center of low transition band
		double high_cutoff_freq,	// Hz center of high transition band
		double transition_width,	// Hz width of transition bands
		win_type WINDOW )


	gr.firdes.band_reject (  \
		double gain,
		double sampling_freq,
		double low_cutoff_freq,		// Hz width of low transition band
		double high_cutoff_freq,	// Hz width of high transitin band
		double transition_width,	// Hz width of transition bands
		win_type WINDOW )


	gr.firdes.hilbert (  \
		int ntaps, 		// Number of taps, must be ODD
		win_type WINDOW )


	gr.firdes.root_raised_cosine (  \
		double gain,
		double sampling_freq,
		double symbol_rate	// Symbol rate, NOT bitrate (unless BPSK)
		double alpha		// Excess Bandwidth Factor
		int ntaps )


	gr.firdes.gaussian (  \
		double gain,
		double sampling_freq,
		double symbol_rate,
		double bt,		// Bandwidth to bitrate ratio
		int ntaps )





Example usage:
First compute the filter taps for, say, a high_pass filter to reject everything below 2Mhz with a 100Khz wide skirt:
	sampling_rate = 8.6
	hpf = gr.firdes.high_pass ( 1.0, sampling_rate, 2e6, 100e3, \
		gr.firdes.WIN_HAMMING )


Now create the filter and we'll use a noise source to see how it looks:
	signal = gr.noise_source_f (gr.GR_GAUSSIAN, 1, 2829)
	filter = gr.fir_filter_fff ( 1, hpf )
which give a response like this:



Complete script: high_pass_rf_filter.py




See the experiment Filtered Noise for a band_pass example.