Skip to main content

FIR vs IIR Digital Filters and Recursive vs Non Recursive Filters



Key Features

  • The higher the order of a filter, the sharper the stopband transition 
  • The sharpness of FIR and IIR filters is very different for the same order 
  • A FIR filter has an equal time delay at all frequencies, while the IIR filter's time delay varies with frequency. Usually, the biggest time delay in the IIR filter is at the filter's cutoff frequency.
  • The term 'IR' (impulse response) is in both FIR and IIR. The term 'impulse response' refers to the appearance of the filter in the time domain. 

1. What Is the Difference Between an FIR and an IIR Filters?


The two major classifications of digital filters used for signal filtration are FIR and IIR. The primary distinction between FIR and IIR filters is that the FIR filter provides a finite period impulse response. In contrast, IIR is a type of filter that produces an infinite-duration impulse response for a dynamic system.

Mathematical representation of a filter equation:

A*y(t) = c1*x(t) + c2*x(t - t0) + c3*x(t - t1) + c4*x(t - t2) + . . . + cn*x(t – tn)

To make A equal 1, we change the values of the coefficients c1, c2, c3, etc., in the filter equation above. We carry out this to recover the original signal from various multipath (with different delay spreads).
We concentrate on taps and the corresponding weights when designing filters. The filter converges for some weightings of various taps. Some filters function quickly, while others function precisely. Applications determine uses. However, the uses for various filters vary. FIR filters have a limited number of taps. Simple FIR filters are linear by nature. Additionally, they generate a finite amount of impulses. IIR filters, on the other hand, can generate an infinite number of impulse responses despite having a finite number of taps since the


Why do we use filters?
The purpose of the use of different kinds of filters is different. But in general, they all smoothen the noisy signal. 
 

MATLAB Code for FIR Filter

In this MATLAB code, we use a FIR filter of order 20 to remove high-frequency noise from a clean sinusoidal signal. The highest frequency component in the sinusoidal signal is 500 Hz. We set the cutoff frequency of the FIR filter to 1000 Hz, so the filter attenuates all frequency components above 1000 Hz. As a result, we are able to recover the original message signal.
 
 
clc;
clear;

% Sampling parameters
Fs = 8000; % Sampling Frequency (Hz)
t = 0:1/Fs:0.1; % 1 second duration

% Create a noisy signal: clean sine wave + high-frequency noise
f_clean = 500; % Clean signal frequency (Hz)
f_noise = 3000; % Noise frequency (Hz)
signal_clean = sin(2*pi*f_clean*t);
signal_noise = 0.5 * sin(2*pi*f_noise*t);
signal = signal_clean + signal_noise;

% FIR Filter Design Parameters
N = 20; % Filter order (number of taps - 1)
fc = 1000; % Cutoff frequency (Hz)
wn = fc / (Fs/2); % Normalized cutoff frequency (0 to 1)

% Design the FIR filter using Hamming window
b = fir1(N, wn, 'low', hamming(N+1)); % 'low' => low-pass filter
% b is the filter coefficient vector

% Apply the FIR filter to the noisy signal
filtered_signal = filter(b, 1, signal);

% Plot the signals
figure;
subplot(3,1,1);
plot(t, signal);
title('Noisy Signal');
xlabel('Time (s)'); ylabel('Amplitude');

subplot(3,1,2);
plot(t, filtered_signal);
title('Filtered Signal (After FIR Low-Pass)');
xlabel('Time (s)'); ylabel('Amplitude');

subplot(3,1,3);
plot(t, signal_clean);
title('Original Clean Signal');
xlabel('Time (s)'); ylabel('Amplitude'); 
web('https://www.salimwireless.com/search?q=filter', '-browser');
 

Output 

 
 
 
 
 
 



2. Difference between recursive and non-recursive filters:


The output of a recursive filter is directly dependent on one or more of its previous outputs. However, in a non-recursive filter, the system used is one in which the output is independent of any previous outputs, such as a feed-forward system with no feedback. As a result, the filter is following a non-recursive system here.

3. Solve: The impulse response of a filter is defined as h[n] =




Now tell us this filter is a
1. Non-recursive IIR filter
2. Recursive IIR filter
3. Non-recursive FIR filter
4. Recursive FIR filter
Answer: Option 3

Generally, an FIR filter has a finite number of impulse responses or a finite period of impulse responses. In the case of FIR, the output is usually independent of the previous output. So, the correct answer to the above question is 'Non-recursive FIR filter,' or option 3.
Next Page>>

Read more about

People are good at skipping over material they already know!

View Related Topics to







Admin & Author: Salim

s

  Website: www.salimwireless.com
  Interests: Signal Processing, Telecommunication, 5G Technology, Present & Future Wireless Technologies, Digital Signal Processing, Computer Networks, Millimeter Wave Band Channel, Web Development
  Seeking an opportunity in the Teaching or Electronics & Telecommunication domains.
  Possess M.Tech in Electronic Communication Systems.


Contact Us

Name

Email *

Message *

Popular Posts

Hybrid Beamforming | Page 2

Beamforming Techniques Hybrid Beamforming... Page 1 | Page 2 | clear all; close all; clc; Nt = 64; Nr = 16; NtRF = 4; NrRF = 4; At both the transmitter and receiver ends, there are four RF chains only for a hybrid beamforming system. Alternatively, every 16 antenna elements on the transmitter side is connected to a single RF chain, while every 4 antenna elements on the receiver side are connected to a single RF chain. Mixers, amplifiers, and other critical wireless communication components make up the RF chain. Now, in the case of hybrid beamforming, there can be four different data streams between the transmitter and receiver, as both sides have four RF chains, each of which is accountable for a separate data stream. For Analog Beamforming: All 64 Tx antenna elements create a beam or focus the resultant correlated signal spread from adjacent antennas to a particular direction. Similarly, it may be used for beam...

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...

📘 Overview of BER and SNR 🧮 Online Simulator for BER calculation of m-ary QAM and m-ary PSK 🧮 MATLAB Code for BER calculation of M-ary QAM, M-ary PSK, QPSK, BPSK, ... 📚 Further Reading 📂 View Other Topics on M-ary QAM, M-ary PSK, QPSK ... 🧮 Online Simulator for Constellation Diagram of m-ary QAM 🧮 Online Simulator for Constellation Diagram of m-ary PSK 🧮 MATLAB Code for BER calculation of ASK, FSK, and PSK 🧮 MATLAB Code for BER calculation of Alamouti Scheme 🧮 Different approaches to calculate BER vs SNR What is Bit Error Rate (BER)? The abbreviation BER stands for bit error rate, which indicates how many corrupted bits are received (after the demodulation process) compared to the total number of bits sent in a communication process. It is defined as,  In mathematics, BER = (number of bits received in error / total number of transmitted bits)  On the other hand, SNR ...

MATLAB Code for Channel Impulse Response

MATLAB Code for Channel Impulse Response (CIR) 📘 Overview & Theory 🧮 MATLAB Code 🤔 How does CIR affect the signal? 🛠️ How to Mitigate Channel Distortion? 📚 Further Reading MATLAB Script for Simulating CIR This MATLAB script allows you to generate and visualize the channel impulse response (CIR). You can choose to create a 'random' multi-path channel or a near-'ideal' single-path channel to understand their distinct characteristics. % User input for choosing the type of impulse response response_type = input('Enter "random" for random channel impulse response or "ideal" for near-ideal impulse response: ', 's'); if strcmpi(response_type, 'random') % Parameters for random impulse response num_taps = input('Enter the number of taps: '); % Number of taps in the channel d...

Comparisons among ASK, PSK, and FSK | And the definitions of each

📘 Comparisons among ASK, FSK, and PSK 🧮 Online Simulator for calculating Bandwidth of ASK, FSK, and PSK 🧮 MATLAB Code for BER vs. SNR Analysis of ASK, FSK, and PSK 📚 Further Reading 📂 View Other Topics on Comparisons among ASK, PSK, and FSK ... 🧮 Comparisons of Noise Sensitivity, Bandwidth, Complexity, etc. 🧮 MATLAB Code for Constellation Diagrams of ASK, FSK, and PSK 🧮 Online Simulator for ASK, FSK, and PSK Generation 🧮 Online Simulator for ASK, FSK, and PSK Constellation 🧮 Some Questions and Answers Modulation ASK, FSK & PSK Constellation MATLAB Simulink MATLAB Code Comparisons among ASK, PSK, and FSK    Comparisons among ASK, PSK, and FSK   Simulator for Calculating Bandwidth of ASK, FSK, and PSK The baud rate represents the number of symbols transmitted per second. Both baud rate and bit rate a...

MATLAB code for BER vs SNR for M-QAM, M-PSK, QPSk, BPSK, ...

🧮 MATLAB Code for BPSK, M-ary PSK, and M-ary QAM Together 🧮 MATLAB Code for M-ary QAM 🧮 MATLAB Code for M-ary PSK 📚 Further Reading MATLAB Script for BER vs. SNR for M-QAM, M-PSK, QPSK, BPSK % Written by Salim Wireless clc; clear; close all; num_symbols = 1e5; snr_db = -20:2:20; psk_orders = [2, 4, 8, 16, 32]; qam_orders = [4, 16, 64, 256]; ber_psk_results = zeros(length(psk_orders), length(snr_db)); ber_qam_results = zeros(length(qam_orders), length(snr_db)); for i = 1:length(psk_orders) psk_order = psk_orders(i); for j = 1:length(snr_db) data_symbols = randi([0, psk_order-1], 1, num_symbols); modulated_signal = pskmod(data_symbols, psk_order, pi/psk_order); received_signal = awgn(modulated_signal, snr_db(j), 'measured'); demodulated_symbols = pskdemod(received_signal, psk_order, pi/psk_order); ber_psk_results(i, j) = sum(data_symbols ~= demodulated_symbols) / num_symbols; end end for ...

Antenna Gain-Combining Methods - EGC, MRC, SC, and RMSGC

📘 Overview 🧮 Equal gain combining (EGC) 🧮 Maximum ratio combining (MRC) 🧮 Selective combining (SC) 🧮 Root mean square gain combining (RMSGC) 🧮 Zero-Forcing (ZF) Combining 🧮 MATLAB Code 📚 Further Reading  There are different antenna gain-combining methods. They are as follows. 1. Equal gain combining (EGC) 2. Maximum ratio combining (MRC) 3. Selective combining (SC) 4. Root mean square gain combining (RMSGC) 5. Zero-Forcing (ZF) Combining  1. Equal gain combining method Equal Gain Combining (EGC) is a diversity combining technique in which the receiver aligns the phase of the received signals from multiple antennas (or channels) but gives them equal amplitude weight before summing. This means each received signal is phase-corrected to be coherent with others, but no scaling is applied based on signal strength or channel quality (unlike MRC). Mathematically, for received signa...

Ultra-Wideband | Positioning, Frequency Range, Power and AoA & AoD detection

Frequency Bands Ultra-Wideband... UWB functions with the signal's so-called Time of Flight rather than RSSI (Received Signal Strength Indication), which makes technology more precise and enables it to conduct extremely precise ranging measurements. This is in contrast to traditional radio technologies (like Bluetooth or Wi-Fi). Key Features of UWB Bands UWB in order to bring decimeter-level positioning to the market There is almost no interference with other radio communication systems Multipath signal propagation resistance  resistance to noise  Low-power transceiver required Ultra Wide Band or UWB comes under the  Super High Frequency Band (SHF) range, as SHF ranges from 3 to 30 GHz. UWB frequency range: 3.1 GHz to 10.6 GHz Ultra-wideband or UWB technology is used for high-speed short-range wireless communication protocol. Now, it is a globally accepted protocol used in Mobile Telephony, AirTags, Medical fields, and NFC (near-field co...

Theoretical vs. simulated BER vs. SNR for ASK, FSK, and PSK

📘 Overview 🧮 Simulator for calculating BER 🧮 MATLAB Codes for calculating theoretical BER 🧮 MATLAB Codes for calculating simulated BER 📚 Further Reading BER vs. SNR denotes how many bits in error are received for a given signal-to-noise ratio, typically measured in dB. Common noise types in wireless systems: 1. Additive White Gaussian Noise (AWGN) 2. Rayleigh Fading AWGN adds random noise; Rayleigh fading attenuates the signal variably. A good SNR helps reduce these effects. Simulator for calculating BER vs SNR for binary ASK, FSK, and PSK Calculate BER for Binary ASK Modulation Enter SNR (dB): Calculate BER Calculate BER for Binary FSK Modulation Enter SNR (dB): Calculate BER Calculate BER for Binary PSK Modulation Enter SNR (dB): Calculate BER BER vs. SNR Curves MATLAB Code for Theoretical BER % The code is written by SalimWireless.Com clc; clear; close all; % SNR v...