top of page

Filtering White Noise in MATLAB: A Comprehensive Guide

Jan 23, 2024

Matlab, a powerful tool developed by MathWorks, offers a plethora of functions to process and analyze signals. Among these functions, filtering white noise is a common task that comes up in various applications, like engineering and data analysis. In this article, we will discuss the steps and techniques for filtering white noise in Matlab.

White noise, by definition, is a random signal with equal intensity at different frequencies. So, to efficiently filter white noise in Matlab, you first need to design an appropriate filter that can selectively remove or preserve certain frequency components of the signal.

There are two major categories of filters: Finite Impulse Response (FIR) and Infinite Impulse Response (IIR). Fir filters have a finite duration in time and do not use feedback loops, while IIR filters have longer durations and usually employ feedback loops. Both types of filters can be applied to filter white noise.

Follow these steps to create and apply filters in Matlab:

  1. Define the sampling rate (Fs) and the duration (T) of your white noise signal.

    Fs = 1000; % Sampling rate in Hz
    T = 1; % Duration in seconds

  2. Generate a random white noise signal using the 'randn' function.

    whiteNoise = randn(Fs*T, 1);

  3. Design the filter. Matlab provides various functions to design FIR and IIR filters, such as 'fir1', 'fir2', 'butter', 'cheby1', and 'ellip'. For example, to design a low-pass Butterworth filter, use the 'butter' function:

    f_cutoff = 200; % Cut-off frequency in Hz
    order = 6; % Filter order
    [B, A] = butter(order, f_cutoff/(Fs/2), 'low');

    In this example, B and A are the filter coefficients for the Butterworth filter.

  4. Apply the filter to the white noise signal using the 'filter' function:

    filteredSignal = filter(B, A, whiteNoise);

  5. If necessary, visualize the original and filtered signals to verify the filtering process. Use Matlab functions like 'plot' and 'pwelch' to plot the signals in time and frequency domain, respectively.

In conclusion, filtering white noise in Matlab involves designing an appropriate filter, generating the white noise signal, and applying the filter to the signal. By following these steps, you can efficiently remove undesired frequency components and achieve the desired result for your application.

bottom of page