Conflicts due to poor backup
This commit is contained in:
parent
cdcaacbeac
commit
310a76fee7
36
FFT.m
36
FFT.m
|
|
@ -1,36 +0,0 @@
|
|||
clear all
|
||||
close all
|
||||
clc
|
||||
|
||||
pkg load io %% to be able to extract from external format (excel)
|
||||
|
||||
data = csvread('RGB_database/RGB_data.csv');
|
||||
standard_deviation = std(data);
|
||||
mean_value = mean(data);
|
||||
|
||||
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
|
||||
endfor
|
||||
|
||||
Fs = 970/32; % Sampling frequency = 970 images in 32 seconds
|
||||
T = 1/Fs; % Sampling period
|
||||
L = 970; % Length of signal = 32 seconds
|
||||
t = (0:L-1)*T; % Time vector
|
||||
|
||||
X = normalized_data_G;
|
||||
|
||||
plot(t(1:970),X(1:970))
|
||||
title("Signal")
|
||||
xlabel("t (milliseconds)")
|
||||
ylabel("X(t)")
|
||||
|
||||
Y = fft(X);
|
||||
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
|
||||
|
||||
plot(f(25:end),P1(25:end))
|
||||
title("Single-Sided Amplitude Spectrum of X(t)")
|
||||
xlabel("f (Hz)")
|
||||
ylabel("|P1(f)|")
|
||||
Loading…
Reference in New Issue