# Apply frequency-dependent attenuation on a signal

6 views (last 30 days)
Fernando on 12 Oct 2022
Edited: Fernando on 12 Oct 2022
Hi.
I am dealing with a series of signals (S) in the time-domain with specific sample rates (Fs), where:
L = signal_size; % Length of signal - 500 in this example
f = Fs*(0:(L/2))/L; % Frequencies
As an example, the signal (S1) looks like this:
For a signal with 500 samples, (f) represents 251 frequency points.
Consider a system where it attenuates signals differently in each of those 251 frequency points.
The attenuation rate (ar) (in dB) for all desired frequencies (f) is available:
How is it possible to apply a frequency-dependent attenuation on a signal?
Is it accurate to take the FFT of the original signal and apply the attenuation rate on half the spectrum (where the frequency response is available), then re-create the full spectrum and take it back to the time domain, as I tried to do in the code below?
A1 = fft(S1); % FFT of the original signal
A2 = A1(1:L/2+1); % Seperating half the spectrum
A2 = A2.*10.^(-ar./20); % Apply system frequnecy response
A3 = flipud(A2(2:end-1)); % Re-creating the seond part
A4 = -1*imag(A3);
A5 = real(A3);
A6 = complex (A5,A4);
A7 = [A2;A6];
A8 = ifft(A7); % Take signal back to time-domain
Your help would be very welcome.
Thanks.