Mercurial > octave-nkf
comparison scripts/signal/sinetone.m @ 19867: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
19866:a1acca0c2216 | 19867:9fc020886ae9 |
---|---|
26 ## @end deftypefn | 26 ## @end deftypefn |
27 | 27 |
28 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> | 28 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> |
29 ## Description: Compute a sine tone | 29 ## Description: Compute a sine tone |
30 | 30 |
31 function retval = sinetone (freq, rate, sec, ampl) | 31 function retval = sinetone (freq, rate = 8000, sec = 1, ampl = 64) |
32 | 32 |
33 if (nargin == 1) | 33 if (nargin < 1 || nargin > 4) |
34 rate = 8000; | |
35 sec = 1; | |
36 ampl = 64; | |
37 elseif (nargin == 2) | |
38 sec = 1; | |
39 ampl = 64; | |
40 elseif (nargin == 3) | |
41 ampl = 64; | |
42 elseif ((nargin < 1) || (nargin > 4)) | |
43 print_usage (); | 34 print_usage (); |
44 endif | 35 endif |
45 | 36 |
46 [err, freq, ampl] = common_size (freq, ampl); | 37 [err, freq, ampl] = common_size (freq, ampl); |
47 if (err || ! isvector (freq)) | 38 if (err || ! isvector (freq)) |