# How to recover the original signal using ifft

9 views (last 30 days)
Enzo Lopes on 11 May 2024
Answered: Hassaan on 11 May 2024
Hello everyone,
I've written a code to test the ifft function in MATLAB. However, I've noticed that ifft returns the same number of points as fft. I'm aiming to recover the original signal, which had 1000 points along with the time vector, t. How can I achieve this?
clear;clc;close all;
dt=2.5e-9;
f = 10e6;
Nfft=8*4096;
t = (0:1000-1)*dt;
sinal = sin(2*pi*f*t);
figure(1)
plot(t,sinal)
%Cálculo da fft
fftsinal=fft(sinal,Nfft);
figure(2)
Paul on 11 May 2024
Hi Enzo,
For this problem, why zero-pad the FFT to Nfft points?

Hassaan on 11 May 2024
clear; clc; close all;
% Time step
dt = 2.5e-9;
% Frequency of the sine wave
f = 10e6;
% Number of points in the original signal
N = 1000;
% Time vector
t = (0:N-1) * dt;
% Original signal
sinal = sin(2*pi*f*t);
% Plot the original signal
figure(1)
plot(t, sinal)
title('Original Signal')
xlabel('Time (s)')
ylabel('Amplitude')
% Compute the FFT of the original signal
fftsinal = fft(sinal);
% Compute the IFFT to recover the signal
% Plot the recovered signal
figure(2)
title('Recovered Signal')
xlabel('Time (s)')
ylabel('Amplitude')
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
• Technical Services and Consulting
• Embedded Systems | Firmware Developement | Simulations
• Electrical and Electronics Engineering
Feel free to contact me.