Original Signal from fft - without using ifft
8 views (last 30 days)
Hi all, I am analysing a signal stored in an matrix (Data), usign fft as follows:
FFT_Data = fft(Data);
magnitude_Data = abs(FFT_Data);
phase_Data = angle(FFT_Data);
Each element of 'Data.mat' is a function of position, hence the equal sizes of Data.mat and Position.mat; I am trying to plot the individual harmonics of the original signal and I am usign:
points = 1024; % points used to analyze the signal Data
L = max(Position); % Distance measured - use it to find Fs hence deduce frequency_matrix to find wavelength
Fs = points/L; % Sampling frequency - equivalent to points per wavelength
frequency_matrix = Fs*linspace(0,1,points)'; % Frequency in Hz
harmonics = magnitude_Data.*cos(phase_Data + 2*pi*reshape(Position,1,1,).*frequency_matrix); % Yields 3D matrix of modeshapes - 3D used since 'Data.mat' may be 1024xn, n = iterations.
My question is, does the line of 'harmonics' correctly provide the harmonics of the signal? It essentially suggests that, e.g. Harmonic = Acos(2πfx + φ) (A,f,φ being amplitude,frequency, phase of that particular harmonic). I raised this question, because when I summed my harmonics as follows:
tested_harmonics = 400; % number of harmonics
A = ; % create empy matrix to store the sum of the harmonics there
for i = 1:tested_harmonics
B = squeeze(harmonics(i,1,:));
A = A+B; % sum the tested harmonics
The plot generated a correct looking waveform, with correct frequency values, but with clearly larger amplitude than the correct signal. I thus assuming that I am calculating the amplitude of my signal incorrectly?
Peng Li on 12 Apr 2020
Matlab fft results are without the 1/N term. If you plot the amplitude spectrum you will find out that the peak amplitude is clearly larger what you expect to see with a simulated sin/cos wave for example. Try to divide your amplitude term by length(Data) and see.