convert the time domain signal into frequency domain signal

28 visualizaciones (últimos 30 días)
Hi, I have represented the acceleration data of 3 axes(x, y, and z) in time domain as shown in the Graph
I would like to extract from the acceleration data some measurements (e.g. mean, energy, entropy and correlation) in the frequency domain. Therefore, I applied FFT transform in order to convert the time domain signal into frequency domain signal.
xx= fft(x_Segments{1});
plot(xx)
yy= fft(y_Segments{1});
plot(yy)
zz= fft(z_Segments{1});
plot(zz)
However, the resulted graphs make no sense( so strange) which is not expected at all !! This is an example of the frequency domain signal of the x-axis.
Note, x_Segments, y_Segments, and z_Segments contain the data of X, Y, Z axes respectively
As we can see the graph doesn't make sense, so, is there any steps that I should follow before using the FFT function to get the expected frequency domain signal?
I really appreciate your help guys. thanks

Respuesta aceptada

Star Strider
Star Strider el 18 de Ag. de 2016
See this version of the documentation for fft.
  52 comentarios
neamah al-naffakh
neamah al-naffakh el 16 de Sept. de 2016
hi sir thanks for your kind help,
actully, I dont know the time units because this application is written by developers, I will back later to discuss this point with you
regards.
Star Strider
Star Strider el 16 de Sept. de 2016
My pleasure.
We really need to know the time units. There are several different time systems in computers, so knowing that will help as well. For example, when did the time reference begin (when did the time = 0)? A datetime object might make the time conversion trivial, or we might have to write code to do the conversion.

Iniciar sesión para comentar.

Más respuestas (2)

Marcel
Marcel el 24 de Ag. de 2016
Hint: In matlab plot(fft(y)) will plot only the real part of your spectrum there by ignoring the imaginary values in each of the frequency samples. You may do the DFT naively by plotting the amplitude of your spectrum or the phase i.e. plot(abs(fft(y))) etc. You may want to look for the pwelch or periodogram accordingly to what you want (PSD ....).
  8 comentarios
neamah al-naffakh
neamah al-naffakh el 25 de Ag. de 2016
Dear Star Strider, do you mind if i attach a PDF file that illustrates what I want to do with the frequency signal?
as the the paper exactly explained what I'd like to measure, please let me know if you are happy with that
With My Respect
neamah al-naffakh
neamah al-naffakh el 25 de Ag. de 2016
Dear Star Strider, please find the attached PDF file.
I have highlighted what the author did in order to convert his time domain signal to frequency- domain and then calculate the Amplitude in a specific frequency but I don't know how to do this in Matlab?
the array called Segments is the original data, could you help me to re-build the code please?

Iniciar sesión para comentar.


RAUNAK GUPTA
RAUNAK GUPTA el 15 de Oct. de 2017
Editada: Walter Roberson el 21 de Nov. de 2021
please help me I want to design audio control mood lamp.....in which I have to record an real time audio data in matlab and interfacing it with microcontroller I have to control light.....HOW to convert a real time audio data in frequency domai?please help me with the code
matlab code
clear all; clc;
rec=audiorecorder(8000,8,1);
ard = arduino('com4');
a = input('Press 1 to start recording\n');
recordblocking(rec,20);
data=getaudiodata(rec);
play(rec);
plot(data);
Fs=8000;
N = length(data);
datafft=fft(data);
datafft_abs=abs(datafft/N);
datafft_abs=datafft_abs(1:N/2+1);
f=Fs*(0:N/2)/N;
arduin(ard,f);
figure;
plot(f,datafft_abs);
clearvars ard;
arduin funtion
function [] = arduin(a,freq)
%This is self made function.
%This function is made for using arduino.
%This function lits up the LEDs according to frequencies it get.
fr = 2; %Frequnecy to be set for red light
fb = 3; %Frequnecy to be set for blue light
configurePin(a,'D8');
configurePin(a,'D9');
configurePin(a,'D13');
for i=1:length(freq)
f = freq(i);
if (f < fr)
disp('RED');
writeDigitalPin(a, 'D9', 0);
writeDigitalPin(a, 'D13', 0);
writeDigitalPin(a, 'D8', 1);
else
if (f<=fb) && (f=fr)
disp('GREEN');
writeDigitalPin(a, 'D8', 0);
writeDigitalPin(a, 'D13', 0);
writeDigitalPin(a, 'D9', 1);
else
if (f>=fb)
disp('Blue');
writeDigitalPin(a, 'D9', 0);
writeDigitalPin(a, 'D8', 0);
writeDigitalPin(a, 'D13', 1);
else
disp('Frequency out of range');
writeDigitalPin(a, 'D8', 1);
writeDigitalPin(a, 'D9', 1);
writeDigitalPin(a, 'D13', 1);
end
end
end
end

Community Treasure Hunt

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

Start Hunting!

Translated by