Inverse Fast Fourier Transform of a Sinc Function and appears to have distortions at two ends of the signal in its time-domain.

27 visualizzazioni (ultimi 30 giorni)
I have a question about the Inverse Fast Fourier Transform (IFFT) function in Matlab. Apparently, I have designed a sinc function code and use the ifft function together with the ifftshift function to obtain the original box function with a magnitude of 1 in the time range from -0.5s to 0.5s as shown as below. Although, the box function has been plotted successfully, there were still some distortions appeared at two ends of the signal in the attached image. I want to ask why there is a distortion like this. My professor gave us a hint about the finite nature of matlab. But still me and my teammates cannot find a report or document discussing about this topic. Can you help us with this, please?
% Set up time and frequency variables
fs4 = 44100; % Sampling frequency rate (CD quality)
Ts4 = 1/fs4; % Step-size (resolution) of simulation
t4 = -2:Ts4:2-Ts4; % 5 seconds time array
N4 = length(t4); % Time length
F4 = fs4/N4; % Frequency step
f4 = (-fs4/2):F4:(fs4/2)-F4; % Frequency array
Xf4 = sinc(f4); % Function in Frequency domain
xt4 = ifftshift(ifft(ifftshift(Xf4)))/Ts4; % Inverse Fourier transform to time-domain function
% Plot function in Time-domain
figure('Name','Inverse FFT of sinc function','NumberTitle','off')
plot(t4, abs(xt4), 'Linewidth', 1.5), axis([-2 2 0 1.2])
xlabel('Time (t4), sec', 'Fontsize', 13), ylabel('x(t)', 'Fontsize', 13)
title('Function in time-domain', 'Fontsize', 14)
grid on
  2 Commenti
Walter Roberson
Walter Roberson il 9 Mag 2023
Notice if you zoom in...
If you use a lower frequency then it gets worse; if you use a higher frequency the problem still exists but you have to zoom in more to see it.
% Set up time and frequency variables
fs4 = 44100; % Sampling frequency rate (CD quality)
Ts4 = 1/fs4; % Step-size (resolution) of simulation
t4 = -2:Ts4:2-Ts4; % 5 seconds time array
N4 = length(t4); % Time length
F4 = fs4/N4; % Frequency step
f4 = (-fs4/2):F4:(fs4/2)-F4; % Frequency array
Xf4 = sinc(f4); % Function in Frequency domain
xt4 = ifftshift(ifft(ifftshift(Xf4)))/Ts4; % Inverse Fourier transform to time-domain function
% Plot function in Time-domain
figure('Name','Inverse FFT of sinc function','NumberTitle','off')
plot(t4, abs(xt4), 'Linewidth', 1.5), axis([-2 2 0 1.2])
xlabel('Time (t4), sec', 'Fontsize', 13), ylabel('x(t)', 'Fontsize', 13)
title('Function in time-domain', 'Fontsize', 14)
grid on
xlim([-0.501 -0.499])
Hieu
Hieu il 9 Mag 2023
I see... but can you explain to me that why did the distortion or the fluctuation happen in this box function in MATLAB? Could you provide us with some related documentation about this? Thank you for your kind respond! We are looking forward to seeing for reply soon.

Accedi per commentare.

Risposta accettata

Santosh Fatale
Santosh Fatale il 19 Mag 2023
Hi Hieu,
I understand that you are using "ifft" function available in MATLAB along with "ifftshift" to plot the inverse Fourier transform of the Sinc function in time domain. While plotting the result of inverse Fourier transform you observe distortions at two ends of the square function.
I investigated the code used by you and below are my observations:
  • Note that the ideal Sinc function is continuous and defined over a real line, i.e., range for Sinc function is ( ,). The Sinc function defined in the code is over an interval of [ -fs4/2, fs4/2) and is not a continuous function.
  • The "ifft" function is used to calculate Inverse Discrete Fourier Transform (IDFT) of the signal and not to calculate the Inverse Continuous Fourier Transform (ICFT). I believe you are looking for ICFT of Sinc function.
  • The phenomenon which you are observing is the effect of truncation which is also called "Gibb’s Phenomenon". Notice that you are truncating the ideal Sinc function to calculate the IDFT which is the main reason for Gibb’s Phenomenon.
You could also calculate the IFFT using ifourier function available in Symbolic math Toolbox.
Kindly refer to the following documentation links for function which you might need to utilise for the same.

Più risposte (0)

Tag

Prodotti


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by