0
mirror of https://github.com/ltian059/Graduation-Project.git synced 2025-02-05 19:37:44 +00:00
itian059-grad-project/Summer 2024 Health Monitoring - Charlie's Work/Charlie_Code/Data Analysis and Matching/MATLAB/FFTanalysis.m
2024-12-04 12:46:40 -05:00

9 lines
198 B
Matlab

function [sub,f] = FFTanalysis(y,fs)
% fs = 1/ts;
len = length(y);
NFFT = 2^nextpow2(len);
y = y-mean(y);
sub = fft(y,NFFT)/len;
sub = 2*abs(sub(1:NFFT/2+1));
f = fs/2*linspace(0,1,NFFT/2+1)*60;
end