clc
clear
Fs = 1000;        % Sampling frequency
T = 1/Fs;                     % Sample time

t1 = xlsread('acc_step_20_25.xlsx','B60002:B80002');
acc1 = xlsread('acc_step_20_25.xlsx','C60002:C80002');
L1 = length(acc1);         % Length of signal
NFFT1 = 2^nextpow2(L1); % Next power of 2 from length of acoustic
Y1 = fft(acc1)/L1;
f1 = Fs/2*linspace(0,1,NFFT1/2+1);
figure(1)
subplot(3,2,1);
plot(f1,2*abs(Y1(1:NFFT1/2+1))); 
title('FFT of Test 1','FontSize',16);
legend('t= 60-80 Sec');
xlabel('Frequency (Hz)');
ylabel('|Acoustic signal|');
grid on
hold on


t2 = xlsread('acc_step_20_25.xlsx','B80003:B100002'); 
acc2 = xlsread('acc_step_20_25.xlsx','C80003:C100002');
L2 = length(acc2);         % Length of signal
NFFT2 = 2^nextpow2(L2); % Next power of 2 from length of acoustic
Y2 = fft(acc2)/L2;
f2 = Fs/2*linspace(0,1,NFFT2/2+1);
figure(1)
subplot(3,2,2);
plot(f2,2*abs(Y2(1:NFFT2/2+1))); 
legend('t= 80-100 Sec');
xlabel('Frequency (Hz)');
ylabel('|Acoustic signal|');
grid on
hold on

t3 = xlsread('acc_step_20_25.xlsx','B100003:B122002');
acc3 = xlsread('acc_step_20_25.xlsx','C100003:C122002');
L3 = length(acc3);         % Length of signal
NFFT3 = 2^nextpow2(L3); % Next power of 2 from length of acoustic
Y3 = fft(acc3)/L3;
f3 = Fs/2*linspace(0,1,NFFT3/2+1);
figure(1)
subplot(3,2,3);
plot(f3,2*abs(Y3(1:NFFT3/2+1))); 
legend('t= 100-122 Sec');
xlabel('Frequency (Hz)');
ylabel('|Acoustic signal|');
grid on
hold on


t4 = xlsread('acc_step_20_25.xlsx','B122003:B140002');
acc4 = xlsread('acc_step_20_25.xlsx','C122003:C140002');
L4 = length(acc4);         % Length of signal
NFFT4 = 2^nextpow2(L4); % Next power of 2 from length of acoustic
Y4 = fft(acc4)/L4;
f4 = Fs/2*linspace(0,1,NFFT4/2+1);
figure(1)
subplot(3,2,4);
plot(f4,2*abs(Y4(1:NFFT4/2+1))); 
legend('t= 122-140 Sec');
xlabel('Frequency (Hz)');
ylabel('|Acoustic signal|');
grid on
hold on


t5 = xlsread('acc_step_20_25.xlsx','B140003:B160002');
acc5 = xlsread('acc_step_20_25.xlsx','C140003:C160002');
L5 = length(acc5);         % Length of signal
NFFT5 = 2^nextpow2(L5); % Next power of 2 from length of acoustic
Y5 = fft(acc5)/L5;
f5 = Fs/2*linspace(0,1,NFFT5/2+1);
figure(1)
subplot(3,2,5);
plot(f5,2*abs(Y5(1:NFFT5/2+1))); 
legend('t= 140-160 Sec');
xlabel('Frequency (Hz)');
ylabel('|Acoustic signal|');
grid on
hold on


t6 = xlsread('acc_step_20_25.xlsx','B160003:B180002'); 
acc6 = xlsread('acc_step_20_25.xlsx','C160003:C180002');
L6 = length(acc6);         % Length of signal
NFFT6 = 2^nextpow2(L6); % Next power of 2 from length of acoustic
Y6 = fft(acc6)/L6;
f6 = Fs/2*linspace(0,1,NFFT6/2+1);
figure(1)
subplot(3,2,6);
plot(f6,2*abs(Y6(1:NFFT6/2+1))); 
legend('t= 160-180 Sec');
xlabel('Frequency (Hz)');
ylabel('|Acoustic signal|');
grid on
hold on
