-
Notifications
You must be signed in to change notification settings - Fork 6
/
getPointImpedanceValue.m
40 lines (36 loc) · 1.09 KB
/
getPointImpedanceValue.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
function a = getPointImpedanceValue(imp, tim)
% GETPOINTIMPEDANCEVALUE Provides an algorithm for giving point impedance
% values
%
% Usage:
% h = myfunction(b)
% Where:
% a - is the output
% imp - impedance values at times tim
%
% Impedance values are streaming every 100ms to Carto 3 system from the
% RF Generator. A time range of -7.5s to +2.5s is output for each point and
% saved in `userdata.electric.impedances` (`.time` and `.value`) in the mat
% files.
%
% GETPOINTIMPEDANCEVALUE converts these time series to a single value by
% taking the peak impedance immediately prior to the 0 time point.
%
% Author: Steven Williams (2014) (Copyright)
% SPDX-License-Identifier: Apache-2.0
%
% Modifications -
%
% Info on Code Testing:
% ---------------------------------------------------------------
% test code
% ---------------------------------------------------------------
%
% ---------------------------------------------------------------
% code
% ---------------------------------------------------------------
[~,loc] = findpeaks(imp);
A = [tim(loc) imp(loc)];
A(A(:,1)>0,:) = [];
a = A(end,2);
end