0
$\begingroup$

In the following Matlab code, the amplitude of the spectral domain signal is printed

Temporal_Pulse_Width=1;
t=linspace(0,20,2000);
dt=t(2)-t(1);
Time_Period=round(Temporal_Pulse_Width/dt);
AA=zeros(length(t),1);
AA(Time_Period/2:3*Time_Period/2)=1;
A=20*log10(abs(fftshift(fft(AA/length(t)))));
frequencyAxis = ((0:length(t)-1) -ceil((length(t)-1)/2))/length(t)/(t(2)-t(1));
plot(frequencyAxis,A,'LineWidth',3);
max(A)

If we change the vector t as follows,

t=linspace(0,10,2000);

The result (max(A)) will also change. How can I normalize the fft without having this problem?

$\endgroup$
2

1 Answer 1

1
$\begingroup$

As you can see in MATLAB documentation for FFT

If you have Y = fft(x) then

$$Y_k = \sum_{j=1}^{N} x_j \cdot exp\left(-\frac{2 \pi i}{n} (k - 1) (j - 1)\right)$$

$$x_j = \frac{1}{n} \sum_{k=1}^{N} X_k \cdot exp\left(+\frac{2 \pi i}{n} (k - 1) (j - 1)\right)$$

Notice that the FFT is just a sum and the IFFT is divided by $n$, with this definition you know that fft(ifft(x)) = x, but as the number of terms increase $Y_k$ will increase.

Your signal is a fixed duration pulse and you want a fixed amplitude in the frequency domain, so it is like an aperiodic Fourier transform

$$ \int x(t) exp\left( \frac{2\pi i}{n} u t \right) dt $$

A zero order approximation for this can be obtained by computing

A=20*log10(abs(fftshift(fft(AA*dt))));

For the pulse of width 1, max(A) will be 0dB this way.

$\endgroup$
2
  • $\begingroup$ Thanks a lot !! $\endgroup$ Mar 5, 2021 at 9:42
  • $\begingroup$ No problem, dsp.stackexchange.com/tour, if that solves, please accept the answer. $\endgroup$
    – Bob
    Mar 5, 2021 at 10:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.