[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53211] detrend functionality missing for comp

From: anonymous
Subject: [Octave-bug-tracker] [bug #53211] detrend functionality missing for complex values
Date: Fri, 23 Feb 2018 15:24:03 -0500 (EST)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6


                 Summary: detrend functionality missing for complex values
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Fri 23 Feb 2018 08:24:02 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Hans Reiser
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.1
        Operating System: Any



Matlab's detrend() function works fine for arrays of complex values, whereas
code working fine with Matlab fails in Octave with the error "detrend: first
input argument must be a real vector or matrix". 

It seems to me that the function's actual functionality would be fine for
complex arguments as well, so the following patch that simply adjusts the
argument check seems to fix the problem and enhance Matlab compatibility:

--- /tmp/detrend.m      2018-02-23 21:18:07.000000000 +0100
+++ share/octave/4.2.1/m/signal/detrend.m       2018-02-23 21:17:55.000000000 
@@ -39,7 +39,7 @@
 function y = detrend (x, p = 1)
-  if (nargin > 0 && isreal (x) && ndims (x) <= 2)
+  if (nargin > 0 && (iscomplex(x)||isreal (x)) && ndims (x) <= 2)
     ## Check p
     if (ischar (p) && strcmpi (p, "constant"))
       p = 0;
@@ -49,7 +49,7 @@
       error ("detrend: second input argument must be 'constant', 'linear' or
a positive integer");
-    error ("detrend: first input argument must be a real vector or matrix");
+    error ("detrend: first input argument must be a real (or complex) vector
or matrix");
   [m, n] = size (x);


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]