Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Butterworth Filtering EEG signal

Subject: Butterworth Filtering EEG signal

From: Riheen

Date: 21 Feb, 2013 06:32:09

Message: 1 of 3

Hi everyone,
I m working on analysis of EEG signal. For that purpose i need low pass filtering of EEG using butterwoth filter in matlab. filtering frequency range is 0-64 Hz. i cant understand which command is needed to use and how to use . please help if anybody knows.

Subject: Butterworth Filtering EEG signal

From: William Frane

Date: 22 Feb, 2013 21:06:18

Message: 2 of 3

There are a few different ways to apply a Butterworth filter to data using MATLAB. Here's a method I often use:

sampleRate = #; % Hz
cutOffFreq = #; % Hz
filterOrder = #; % Filter order (e.g., 2 for a second-order Butterworth filter)
[b, a] = butter(filterOrder, cutOffFreq/(sampleRate/2)); % Generate filter coefficients
filteredData = filtfilt(b, a, inputData); % Apply filter to data using zero-phase filtering

For this code above to work, the Signal Processing Toolbox is required.

Note that the cut-off frequency is divided by half the sample rate (according to the Nyquist sampling theorem, half the sample rate is the maximum frequency that can be represented in discrete data and thus it is this value that the cut-off frequency is normalized relative to). Also note that using filtfilt (rather than the filter function) doubles the effective order of the filter because filtfilt applies it to the data twice (in opposite directions) to remove phase distortion.

Hope that helps.

Will

Subject: Butterworth Filtering EEG signal

From: Riheen

Date: 23 Feb, 2013 16:40:10

Message: 3 of 3

"William Frane" wrote in message <kg8mka$cct$1@newscl01ah.mathworks.com>...
> There are a few different ways to apply a Butterworth filter to data using MATLAB. Here's a method I often use:
>
> sampleRate = #; % Hz
> cutOffFreq = #; % Hz
> filterOrder = #; % Filter order (e.g., 2 for a second-order Butterworth filter)
> [b, a] = butter(filterOrder, cutOffFreq/(sampleRate/2)); % Generate filter coefficients
> filteredData = filtfilt(b, a, inputData); % Apply filter to data using zero-phase filtering
>
> For this code above to work, the Signal Processing Toolbox is required.
>
> Note that the cut-off frequency is divided by half the sample rate (according to the Nyquist sampling theorem, half the sample rate is the maximum frequency that can be represented in discrete data and thus it is this value that the cut-off frequency is normalized relative to). Also note that using filtfilt (rather than the filter function) doubles the effective order of the filter because filtfilt applies it to the data twice (in opposite directions) to remove phase distortion.
>
> Hope that helps.
>
> Will
Thanks a lot willium. It was helpful.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us