FIR Digital Filter MATLAB source code

This section of MATLAB source code covers FIR digital filter matlab code. It describes FIR filter as per rectangular,Bartlett,Blackman,Chebyshev,Hamming and Hanning window types.

This page covers FIR Digital Filter with window type as Hamming window. The same is used by 'fir1' matlab function by default.

FIR digital filter operates on digital sample values. It uses current and past input samples to produce a current output sample. It does not use previous output samples. There are various types of FIR filter based on need viz. low pass,high pass, band pass and band stop.Low pass filter is described in the below code.

FIR Filter Specifications

Following points are usually considered to design FIR filter other the window type.
• Window Type
• Passband and stopband ripples
• passband and stopband edge frequencies
• sampling frequency
• order of the filter
• window coefficients
• magnitude and phase responses

Entering Input parameters

clc;clear all;close all; rp=input('enter the passband ripple(Example:0.02):');
rs=input('enter the stopband ripple(Example:0.01):');
fp=input('enter the passband freq(Example:1500):');
fs=input('enter the stopband freq(Example:2000):');
f=input('enter the sampling freq(Example:6000):');

MATLAB built-in 'fir1' MATLAB function

if (rem(n,2)~=0)

% low-pass filter
figure,plot(o/pi,m);title('FIR Filter Response');ylabel('Gain in dB');xlabel('Normalised frequency');

INPUT and OUTPUT of Low Pass FIR filter

FIR filter input
FIR filter output

Low Pass and High Pass FIR Filter using kaiser,rectangular and triangular window method

FIR LPF HPF using triangular window method
FIR LPF HPF using rectangular window method
FIR LPF HPF using kaiser window method

Useful Links to MATLAB codes

Refer following as well as links mentioned on left side panel for useful MATLAB codes.
PTS for PAPR reduction
OFDM Preamble generation
Time off estimation corr
Freq off estimation corr
channel estimation
11a WLAN channel
Low Pass FIR
Viterbi decoder

RF and Wireless tutorials

WLAN  802.11ac  802.11ad  wimax  Zigbee  z-wave  GSM  LTE  UMTS  Bluetooth  UWB  IoT  satellite  Antenna  RADAR