File Exchange

image thumbnail

A-weighting Filter with Matlab

version (2 KB) by Hristo Zhivomirov
A-weighting of a signal via spectral processing in the frequency domain.


Updated 17 Dec 2018

View License

The present code is a Matlab function that provides an A-weighting of a given signal via spectral processing.

An example is given in order to clarify the usage of the function. For convenience, the input and output arguments are given in the beginning of the function.

The code is based on the theory described in:

[1] Design Response of Weighting Networks for Acoustical Measurements ANSI S1.42-2001. Washington, American National Standards Institute, 2001.

[2] Electroacoustics Sound Level Meters Part 1: Specifications IEC 61672-1:2002. Geneva, International Electrotechnical Commission, 2002.

Cite As

Hristo Zhivomirov (2020). A-weighting Filter with Matlab (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

Troy Bouman

Thank you!

Hristo Zhivomirov

Hi, Ifigenia!
In order to resolve the issue you can filter the signal (time series) x[n] as y = filterA(x, fs); and then you can find the dB(A) values as Y = 20*log10(y/2e-5);. If you need some additional help, do not hesitate to contact me.

All best,

Ifigenia Aslanidou

Hello!Can anyone help me calculating the SPL in Db(A)?
I have the Sound Pressure signal in Pa and I need it dB(a).
Using this function, and using for x the Sound pressure Level I computed , I get a result of NaN.
I appreciate any help :)

Hristo Zhivomirov

Hi Jonas! Thank you for your comment! Everything is alright with the function now! You may test and share your opinion about it!

Best regards,

Jonas Stehli

Hi. I think this implementation is wrong. When plotting 20*log10(A) over frequency, this does not at all match the blue curve in
I think you are off by a square, i.e., a factor 2 in logarithmic domain. If you'd take the square root of the weighting curve before multiplying with the signal spectrum, you'd be more or less correct.

Tom Ransegnola

Very helpful! Thank you!


Does anyone help me related with dbA filter please?

Hristo Zhivomirov

Hi Steve! I can't resolve the problem at this stage, since I haven't enough information. Please, send me the figure, it will be a good starting point.


I made a comparison of the resulting spectrum using this time domain filter and the resulting spectrum using a direct implementation of the frequency domain definition of A-weighting as per the ANSI Standard S1.42-2001. Agreement was less than satisfactory.

My sampling rate was 25.6 kHz. Maybe this is too low. Let me know if you have any suggestions. I can send a figure showing the comparison if you'd like.


Change of the title of the submission.

A new version of the code has been uploaded.

A new version of the code has been uploaded.

A new version of the code has been uploaded.

Typos correction has been made.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux