Mercurial > hg > octave-nkf
changeset 16938:78c022f1d6f7
Add new function atan2d to Octave.
* scripts/elfun/atan2d.m: New file.
* scripts/elfun/module.mk: Add atan2d.m to build system.
* NEWS: Announce new function.
* doc/interpreter/arith.txi: Add to documentation.
* scripts/help/__unimplemented__.m: Remove atan2d from unimplemented list.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 09 Jul 2013 15:29:48 -0700 |
parents | 57fad64de019 |
children | 06897f865f0b |
files | NEWS doc/interpreter/arith.txi scripts/elfun/atan2d.m scripts/elfun/module.mk scripts/help/__unimplemented__.m |
diffstat | 5 files changed, 58 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS +++ b/NEWS @@ -187,20 +187,21 @@ ** Other new functions added in 3.8.0: - base64_decode ellipke lines - base64_encode erfcinv polyeig - betaincinv erfi readline_re_read_init_file - built_in_docstrings_file expint readline_read_init_file - cmpermute findfigs rgbplot - cmunique fminsearch save_default_options - colorcube gallery shrinkfaces - copyobj gco splinefit - dawson hdl2struct stemleaf - dblist history_save strjoin - debug_jit importdata struct2hdl - doc_cache_create iscolormap tetramesh - ellipj jit_enable waterfall - imformats + atan2d erfcinv readline_re_read_init_file + base64_decode erfi readline_read_init_file + base64_encode expint rgbplot + betaincinv findfigs save_default_options + built_in_docstrings_file fminsearch shrinkfaces + cmpermute gallery splinefit + cmunique gco stemleaf + colorcube hdl2struct strjoin + copyobj history_save struct2hdl + dawson imformats tetramesh + dblist importdata waterfall + debug_jit iscolormap + doc_cache_create jit_enable + ellipj lines + ellipke polyeig ** Deprecated functions.
--- a/doc/interpreter/arith.txi +++ b/doc/interpreter/arith.txi @@ -190,6 +190,7 @@ @DOCSTRING(asind) @DOCSTRING(acosd) @DOCSTRING(atand) +@DOCSTRING(atan2d) @DOCSTRING(asecd) @DOCSTRING(acscd) @DOCSTRING(acotd)
new file mode 100644 --- /dev/null +++ b/scripts/elfun/atan2d.m @@ -0,0 +1,41 @@ +## Copyright (C) 2013 Rik Wehbring +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {} atan2d (@var{y}, @var{x}) +## Compute atan2 (@var{y} / @var{x}) in degrees for corresponding elements +## from @var{y} and @var{x}. +## @seealso{tand, atan2} +## @end deftypefn + +function retval = atan2d (y, x) + + if (nargin != 2) + print_usage (); + endif + + retval = 180 ./ pi .* atan2 (y, x); + +endfunction + + +%!assert (atan2d (-1:.1:1, 1:-.1:-1), 180/pi * atan2 (-1:.1:1, 1:-.1:-1), -10*eps) + +%!error atan2d () +%!error atan2d (1) +