clc
clear all
close all
load('machine.mat')

machine1=table2array(machine);
MAT=[];
MATTIMEDOMAIN=[];
for i=2:1:18
temp=machine1(4:516,i)';
MAT=[MAT;temp];
end
figure
imagesc(MAT)
    xlabel('Frequency (Hz)')
ylabel('RPM')

RPM=machine1(1,2:end);
frequen=machine1(4:end,1);
MAT=MAT';
%[map,fp,rp]=rpmfreqmap(MAT,frequen,RPM);
[RP,FP]=meshgrid(RPM,frequen);

figure
surf(RP,FP,MAT)
xlabel('RPM')
ylabel('Frequency (Hz)')
zlabel('Amplitude')
figure
waterfall(RP,FP,MAT)
xlabel('RPM')
ylabel('Frequency (Hz)')
zlabel('Amplitude')
%figure
%imagesc(MAT)
%ylabel('Frequency (Hz)')
%xlabel('RPM')
figure
subplot(4,4,1)
plot(RPM,MAT(53,:))
title('1225Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,2)
plot(RPM,MAT(58,:))
title('1350Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,3)
plot(RPM,MAT(66,:))
title('1550Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,4)
plot(RPM,MAT(98,:))
title('2350Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,5)
plot(RPM,MAT(105,:))
title('2525Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,6)
plot(RPM,MAT(200,:))
title('4900Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,7)
plot(RPM,MAT(210,:))
title('5150Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,8)
plot(RPM,MAT(322,:))
title('7950Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,9)
plot(RPM,MAT(323,:))
title('7975Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,10)
plot(RPM,MAT(324,:))
title('8000Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,11)
plot(RPM,MAT(436,:))
title('10800Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,12)
plot(RPM,MAT(441,:))
title('10925Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,13)
plot(RPM,MAT(506,:))
title('12550Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,14)
plot(RPM,MAT(508,:))
title('12600Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,15)
plot(RPM,MAT(510,:))
title('12650Hz')
ylabel('amplitude')
xlabel('RPM')

subplot(4,4,16)
plot(RPM,MAT(513,:))
title('12725Hz')
ylabel('amplitude')
xlabel('RPM')

 figure
 subplot (4,4,1)
plot(frequen,MAT(:,2))
 title('299 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,2)
plot(frequen,MAT(:,3))
 title('329 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,3)
plot(frequen,MAT(:,4))
 title('360 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,4)
plot(frequen,MAT(:,5))
title('390 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,5)
plot(frequen,MAT(:,6))
 title('420 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,6)
plot(frequen,MAT(:,7))
title('450 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,7)
plot(frequen,MAT(:,8))
 title('480 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,8)
plot(frequen,MAT(:,9))
 title('510 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,9)
plot(frequen,MAT(:,10))
title('539 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,10)
plot(frequen,MAT(:,11))
 title('570 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,11)
plot(frequen,MAT(:,12))
title('599 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,12)
plot(frequen,MAT(:,13))
title('630 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,13)
plot(frequen,MAT(:,14))
 title('659 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,14)
plot(frequen,MAT(:,15))
title('689 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,15)
plot(frequen,MAT(:,16))
 title('719 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')

subplot (4,4,16)
plot(frequen,MAT(:,17))
 title('749 rpm')
ylabel('amplitude')
xlabel('Frequency (Hz)')
    
 
    