-
Notifications
You must be signed in to change notification settings - Fork 1
/
digitasi.m
55 lines (50 loc) · 1.44 KB
/
digitasi.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
ld=0.00635;%faktor penyesuaian amplitudo dengan mm;
% ld=0.0483;%dengan mm 600dpi
target1R = 0 ;
%R = k;%(:,:,1);
matches1 = k == target1R ;
[x1, y1] = find(matches1);
DATA =[y1, x1];
sementara = unique(DATA,'rows');
lsementara = length(sementara);
jj = 1;
for ii = 1 : lsementara
if ii > 1
if sementara(ii, 1) == sementara(ii - 1, 1)
continue
end
end
if ii < lsementara
if sementara(ii, 1) == sementara(ii + 1, 1)
sementara2(jj,1) = sementara(ii, 1);
sementara2(jj,2) = max(sementara(ii, 2),sementara(ii + 1, 2));
else
sementara2(jj, 1) = sementara(ii, 1);
sementara2(jj, 2) = sementara(ii, 2);
end
else
sementara2(jj, 1) = sementara(ii, 1);
sementara2(jj, 2) = sementara(ii, 2);
end
jj = jj + 1;
end
HASIL_AKHIRAVF=sementara2(:,2);
HASIL_AKHIRAVF=(HASIL_AKHIRAVF)*ld;
maksim=max(HASIL_AKHIRAVF);
minim=min(HASIL_AKHIRAVF);
media=median((HASIL_AKHIRAVF));
HASIL_AKHIRAVF=HASIL_AKHIRAVF-media;
TG=maksim-minim;
fs=23;
%fs=1%400;%figure(3)
figure, plot([0:length(HASIL_AKHIRAVF)-1]/fs,HASIL_AKHIRAVF);
grid on
PJ=length(HASIL_AKHIRAVF)/fs;
xlabel('Periode (mm)');
ylabel('Amplitude (mm)');
datacursormode on
peak=findpeaks(HASIL_AKHIRAVF,'SortStr','descend');
%title('Plot')
csvwrite('test.dat',HASIL_AKHIRAVF);
%plot(peak)
figure,findpeaks(HASIL_AKHIRAVF,'MinPeakHeight',mean(HASIL_AKHIRAVF),'MinPeakDistance',60);