Testing FFT

This commit is contained in:
Maryne DEY 2023-02-09 11:25:09 +01:00
parent 78e98b40a0
commit 58014da93d
1 changed files with 11 additions and 5 deletions

View File

@ -13,19 +13,25 @@
pkg load io %% to be able to extract from external format (excel) pkg load io %% to be able to extract from external format (excel)
data = csvread('RGB_database/RGB_data.csv') data = csvread('RGB_database/RGB_data.csv');
standard_deviation = std(data) standard_deviation = std(data);
mean_value = mean(data) mean_value = mean(data);
for i = 1:size(data,1) for i = 1:size(data,1)
normalized_data_G(i,1) = (data(i,2)-mean_value(2))/standard_deviation(2); %%2 and not 1 because green is the 2nd color normalized_data_G(i,1) = (data(i,2)-mean_value(2))/standard_deviation(2); %%2 and not 1 because green is the 2nd color
endfor endfor
fft_green = fft(normalized_data_G) normalized_data_G
plot([1:size(fft_green,1)],fft_green) fft_green = fft(normalized_data_G);
frequency = [];
for i = 1:length(fft_green)
frequency(i) = (i-1)*30/length(fft_green);
endfor
plot(frequency,fft_green)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%