Mercurial > hg > octave-nkf
comparison scripts/signal/diffpara.m @ 20038: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
20037:a1acca0c2216 | 20038:9fc020886ae9 |
---|---|
39 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> | 39 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> |
40 ## Description: Estimate the fractional differencing parameter | 40 ## Description: Estimate the fractional differencing parameter |
41 | 41 |
42 function [d, dd] = diffpara (x, a, b) | 42 function [d, dd] = diffpara (x, a, b) |
43 | 43 |
44 if ((nargin < 1) || (nargin > 3)) | 44 if (nargin < 1 || nargin > 3) |
45 print_usage (); | 45 print_usage (); |
46 endif | |
47 | |
48 if (isvector (x)) | |
49 n = length (x); | |
50 k = 1; | |
51 x = reshape (x, n, 1); | |
46 else | 52 else |
47 if (isvector (x)) | 53 [n, k] = size (x); |
48 n = length (x); | 54 endif |
49 k = 1; | 55 if (nargin == 1) |
50 x = reshape (x, n, 1); | 56 a = 0.5 * sqrt (n); |
51 else | 57 b = 1.5 * sqrt (n); |
52 [n, k] = size (x); | 58 elseif (nargin == 2) |
53 endif | 59 b = a; |
54 if (nargin == 1) | 60 a = 1; |
55 a = 0.5 * sqrt (n); | |
56 b = 1.5 * sqrt (n); | |
57 elseif (nargin == 2) | |
58 b = a; | |
59 a = 1; | |
60 endif | |
61 endif | 61 endif |
62 | 62 |
63 if (! (isscalar (a) && isscalar (b))) | 63 if (! (isscalar (a) && isscalar (b))) |
64 error ("diffpara: A and B must be scalars"); | 64 error ("diffpara: A and B must be scalars"); |
65 endif | 65 endif |