File Exchange

## A-weighting Filter with Matlab

version 1.5.0.0 (2 KB) by Hristo Zhivomirov

### Hristo Zhivomirov (view profile)

A-weighting of a signal via spectral processing in the frequency domain.

Updated 17 Dec 2018

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 (2019). A-weighting Filter with Matlab (https://www.mathworks.com/matlabcentral/fileexchange/46819-a-weighting-filter-with-matlab), MATLAB Central File Exchange. Retrieved .

Troy Bouman

### Troy Bouman (view profile)

Thank you!

Hristo Zhivomirov

### Hristo Zhivomirov (view profile)

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,
Hristo

Ifigenia Aslanidou

### Ifigenia Aslanidou (view profile)

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

### Hristo Zhivomirov (view profile)

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,
Hristo

Jonas Stehli

### Jonas Stehli (view profile)

Hi. I think this implementation is wrong. When plotting 20*log10(A) over frequency, this does not at all match the blue curve in https://upload.wikimedia.org/wikipedia/en/c/c2/Lindos3.svg.
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

micpro

### micpro (view profile)

Hi,
Does anyone help me related with dbA filter please?

Hristo Zhivomirov

### Hristo Zhivomirov (view profile)

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.

Steve

### Steve (view profile)

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.