comparison scripts/signal/unwrap.m @ 19833:9fc020886ae9

maint: Clean up m-files to follow Octave coding conventions. Try to trim long lines to < 80 chars. Use '##' for single line comments. Use '(...)' around tests for if/elseif/switch/while. Abut cell indexing operator '{' next to variable. Abut array indexing operator '(' next to variable. Use space between negation operator '!' and following expression. Use two newlines between endfunction and start of %!test or %!demo code. Remove unnecessary parens grouping between short-circuit operators. Remove stray extra spaces (typos) between variables and assignment operators. Remove stray extra spaces from ends of lines.
author Rik <rik@octave.org>
date Mon, 23 Feb 2015 14:54:39 -0800
parents 4197fc428c7d
children f1d0f506ee78
comparison
equal deleted inserted replaced
19832:a1acca0c2216 19833:9fc020886ae9
34 34
35 if (nargin < 1 || nargin > 3) 35 if (nargin < 1 || nargin > 3)
36 print_usage (); 36 print_usage ();
37 endif 37 endif
38 38
39 if (!isnumeric (x)) 39 if (! isnumeric (x))
40 error ("unwrap: X must be a numeric matrix or vector"); 40 error ("unwrap: X must be a numeric matrix or vector");
41 endif 41 endif
42 42
43 if (nargin < 2 || isempty (tol)) 43 if (nargin < 2 || isempty (tol))
44 tol = pi; 44 tol = pi;
76 d = x(idx{:}) - x; 76 d = x(idx{:}) - x;
77 77
78 ## Find only the peaks, and multiply them by the appropriate amount 78 ## Find only the peaks, and multiply them by the appropriate amount
79 ## of ranges so that there are kronecker deltas at each wrap point 79 ## of ranges so that there are kronecker deltas at each wrap point
80 ## multiplied by the appropriate amount of range values. 80 ## multiplied by the appropriate amount of range values.
81 p = ceil (abs (d)./rng) .* rng .* (((d > tol) > 0) - ((d < -tol) > 0)); 81 p = ceil (abs (d)./rng) .* rng .* (((d > tol) > 0) - ((d < -tol) > 0));
82 82
83 ## Now need to "integrate" this so that the deltas become steps. 83 ## Now need to "integrate" this so that the deltas become steps.
84 r = cumsum (p, dim); 84 r = cumsum (p, dim);
85 85
86 ## Now add the "steps" to the original data and put output in the 86 ## Now add the "steps" to the original data and put output in the