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?