Doubt in FFT and one-third octave analysis

9 views (last 30 days)
I am trying to do FFT of signal in time domain and would like to check IFFT, so that my FFT is correct. But my IFFT doesnot matches original signal. Here is the code attached. Further I am trying to do one third octave band value of the signal (dB) vs frequency, but no idea about one-third octave analysis.
clc;clear all;close all;
%% read data
data_1=xlsread('Force_pier.xlsx');% Signal data in Time-Domain
t_com=xlsread('time.xlsx');% time data
figure(1);plot(t_com,data_1,'linewidth',2);title('Time response');% response in time domain
N=length(data_1);% Number Of Samples
Ts=mean(diff(t_com));% Sampling Interval
Fs=1/Ts;% Sampling Frequency
Fn=Fs/2;% Nyquist Frequency
%% FFT
FT_signal=fft(data_1)/N;% Normalized Fourier Transform Of Data
Fv=linspace(0,1,fix(N/2)+1)*Fn; % Frequency Vector (For ‘plot’ Call)
Iv=1:length(Fv);% Index Vector (Matches ‘Fv’)
figure(2);plot(Fv,abs(FT_signal(Iv))*2,'linewidth',2);title('frequency response');% FFT of the signal in frequency domain
%% IFFT
yy=ifft((FT_signal)); % inverse fft
N2=length(FT_signal); % determine the length of the signal
dt2=1/Fs; % determine the time increment
tim=0:dt2:(N2-1)*dt2; %create the time axis
figure(3);plot(tim,yy,'linewidth',2);title('back to time domain');
  4 Comments
David Goodmanson
David Goodmanson on 27 Sep 2023
Hi SP
if the time array is not equally spaced, you should not expect to get agreement. Leaving that aside, you have
FT_signal=fft(data_1)/N; % Normalized Fourier Transform Of Data
yy=ifft((FT_signal)); % inverse fft
But fft and ifft are inverses of each other, so if you multiply the fft by 1/N (which is commonly done), then to get back to the original signal you have to multiply the ifft output (yy here) by N. Otherwise you're off by a factor of N.

Sign in to comment.

Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!