-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzero_crossing.m
More file actions
54 lines (48 loc) · 1.39 KB
/
zero_crossing.m
File metadata and controls
54 lines (48 loc) · 1.39 KB
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
function zx = zero_crossing(signal,scale, cwtf)
%ZERO_CROSSING Summary of this function goes here
% Detailed explanation goes here
if(cwtf == 1)
figure
ax = subplot(3,1,1);
plot(0:1:23,signal);
title(ax,'Analyzed Signal');
xlabel(ax,'time');
ylabel(ax,'scale');
wt = cwt(signal,scale,'morl');
ax1 = subplot(3,1,2);
plot(wt);
title(ax1,'Transformed Signal with Morlet');
xlabel(ax1,'time');
ylabel(ax1,'scale');
ax2 = subplot(3,1,3);
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0);
zx = zci(wt);
plotzerocrossing = plot(wt(zx));
plotzerocrossing.Marker = '*';
title(ax2,'Zero-crossing points along the curve');
ylabel(ax2,'scale');
grid on;
end
if(cwtf == 2)
figure
ax = subplot(3,1,1);
plot(0:1:23,signal);
title(ax,'Analyzed Signal');
xlabel(ax,'time');
ylabel(ax,'scale');
wt = cwt(signal,scale,'mexh');
ax1 = subplot(3,1,2);
plot(wt);
title(ax1,'Transformed Signal with Mexican Hat');
xlabel(ax1,'time');
ylabel(ax1,'scale');
ax2 = subplot(3,1,3);
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0);
zx = zci(wt);
plotzerocrossing = plot(wt(zx));
plotzerocrossing.Marker = '*';
title(ax2,'Zero-crossing points along the curve');
ylabel(ax2,'scale');
grid on;
end
return