I have done the FFT analysis of a real time data. Please check weather am i right or not ?
Show older comments
clc;
clear;
close all;
%%Time Domain Plot
vib1=readtimetable("sing2.txt","SampleRate",1);
tiledlayout(5,1)
nexttile
plot(vib1.Time,vib1.Sing1)
N=length(vib1.Sing1);
xlabel("Time(s)")
ylabel("Ampl(mm/s^2)")
%% FFt
fs=1;%Sampling Frequency
delt=seconds(1/fs); %time step
t=0:1:length(vib1.Sing1)-1;
Totaltime=(length(vib1.Sing1)-1);
my_fft=2/N*(fft(vib1.Sing1));%FFT of Signal
abs_fft=abs(my_fft); %Absolute value of fft
delf=1/Totaltime; %Frequency Resolution
n2=1:1:N/2; %fft results are plotted for N/2 data points
fk=delf*n2;% frequency values
nexttile
plot(fk,abs_fft(1:N/2))
[v,p]=findpeaks(abs_fft(1:N/2),fk,'Threshold',0.03);
findpeaks(abs_fft(1:N/2),fk,'MinPeakHeight',0.03)
xlabel("Frequency (Hz)")
ylabel("Ampl(mm/s^2)")
%%Spectral density
nexttile
pspectrum(vib1.Sing1,vib1.Time,"spectrogram")
Accepted Answer
More Answers (0)
Categories
Find more on Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!