# convert the time domain signal into frequency domain signal

11 views (last 30 days)
hi guys, this is the second part of this topic ,
I have divided into two part in order to make the topic readable and useful and I'd like to thank Mr Star Strider for his useful answer and support
Ok, let carry on
I have the acceleration data of 3 axes(x, y, and z) and it's represented in time domain signal.
There are about 10500 records (data points or samples)in the file for each axis and I have divided these records into segments ( each segment contains 256 data points.
now, I'd like to convert each segment in the time domain into frequency domain .
As we know this can be done using FFT function
One of the limitations of using the FFT function is that the number of data points in the segment must be a power of two. and I have already fixed the size of each segment into 256( 2 to the power 8)
i have used this code,
% FD_Signal_X{nn,1}=fft(X_Segments_256{nn});
Note, NN is the number of segments, X_Segments_256 contains the data of X axes of each segment, which is 256
my question is
1- I have used this code to calculate the Energy of the frequency domain signal,
FD_Signal_X{nn,1}=fft(X_Segments_256{nn});
Energy_X{nn,1} = (FD_Signal_X{nn}).^2;
or this one is correct?
FD_Signal_X{nn,1}=fft(X_Segments_256{nn});
Magnitude_X {nn,1} = abs(FD_Signal_X{nn});
Energy_X{nn,1} = (Magnitude_X{nn}).^2;
With my respect

Star Strider on 6 Sep 2016
The second is correct.
The first squares a complex signal, so both the real an imaginary parts of the signal are squared, producing a complex result. I do not believe that is what you want. I would not use it.
The second squares the absolute value of the complex signal, producing a real result. That calculates the power in your signal, essentially the power spectral density of your signal.
The energy of your signal at each frequency is the absolute value of the Fourier transform of your signal. The power at each frequency is the square of the energy.
neamah al-naffakh on 5 May 2017
Dear Star Strider, how are you? sorry for bothering again, could you please help me with this topic, it is signal processing!