39 lines
1.1 KiB
Matlab
39 lines
1.1 KiB
Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
%function []= plotFFT(averageArray, nbIm, fps)
|
|
%
|
|
% Task: plotting the fast fourier transform of the average color of the ROI
|
|
%
|
|
% Inputs:
|
|
% - averageArray : function of the average color of the ROI over time
|
|
% - nbIm : integer, number of images stored from the video
|
|
% - fps : frames per seconds of the video
|
|
%
|
|
% Outputs:
|
|
% - plot of the fast fourier transform of the average color of the ROI
|
|
%
|
|
% Antoine Rodary - Julian Leclerc - Gwenn Durpoix-Espinasson - Luc Pichot
|
|
% 06/04/2021
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
function []= plotFFT(averageArray, nbIm,fps)
|
|
|
|
display("Plot FFT Start")
|
|
Fs = fps; % Sampling frequency
|
|
T = 1/Fs; % Sampling period
|
|
L = nbIm; % Length of signal
|
|
t = (0:L-1)*T; % Time vector
|
|
Y = fft(averageArray);
|
|
|
|
P2 = abs(Y/L);
|
|
P1 = P2(1:L/2+1);
|
|
P1(2:end-1) = 2*P1(2:end-1);
|
|
f = Fs*(0:(L/2))/L;
|
|
figure(2);
|
|
plot(f,P1)
|
|
title('Fast Fourier Transform of the signal of the average color of the ROI')
|
|
xlabel('f (Hz)')
|
|
ylabel('|P1(f)|')
|
|
display("Plot FFT End")
|
|
hold on;
|
|
endfunction
|