-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind_min.m
More file actions
executable file
·25 lines (23 loc) · 871 Bytes
/
find_min.m
File metadata and controls
executable file
·25 lines (23 loc) · 871 Bytes
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FIND_MIN() function
%
% Finds the minima in a voltage trace V.
%_______________________________________________________________
% Arguments:
% V = vector of voltage values
%_______________________________________________________________
% Returns:
% H = vector of length(V), s.t.:
% H(i) = V(i) if V(i) is a local minimum,
% H(i) = 0 otherwise.
%_______________________________________________________________
% (c) 2003 Witold J. Lipski. Please feel free to copy
% and/or modify this code. Questions/Comments: wjl3@pitt.edu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function H = find_min(V)
H = zeros(size(V));
for i = 1:length(V)-2
if (V(i+1)<=V(i)) & (V(i+2)>V(i+1))
H(i+1) = V(i+1);
end
end