octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #33523] Matlab compatibility issue with averag


From: Michael Godfrey
Subject: [Octave-bug-tracker] [bug #33523] Matlab compatibility issue with averaging the 3rd dim of a 2-D array
Date: Fri, 29 Jun 2012 15:40:22 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20100101 Firefox/13.0.1

Follow-up Comment #7, bug #33523 (project octave):

This seems to be a reasonable request, and helps with
Matlab compatibility.  However, the behavior shown below
seems not to match the Matlab doc:

>> help mean
 MEAN   Average or mean value.
    For vectors, MEAN(X) is the mean value of the elements in X. For
    matrices, MEAN(X) is a row vector containing the mean value of
    each column.  For N-D arrays, MEAN(X) is the mean value of the
    elements along the first non-singleton dimension of X.
 
    MEAN(X,DIM) takes the mean along the dimension DIM of X. 
 
    Example: If X = [0 1 2
                     3 4 5]
 
    then mean(X,1) is [1.5 2.5 3.5] and mean(X,2) is [1
                                                      4]
 
    Class support for input X:
       float: double, single
=====================

Given this, what is the correct behavior for mean(X,3)?
Matlab says:
>> x = [ 0 1 2; 3 4 5]

x =

     0     1     2
     3     4     5

>> mean(x,2)

ans =

     1
     4

>> mean(x,3)

ans =

     0     1     2
     3     4     5

>> mean(x,4)

ans =

     0     1     2
     3     4     5

>
Should the documentation or the behavior be implemented?



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?33523>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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