help-octave
[Top][All Lists]
Advanced

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

Re: Taking a mean of a fixed length number of points


From: Nicholas Jankowski
Subject: Re: Taking a mean of a fixed length number of points
Date: Fri, 29 Nov 2019 20:50:00 -0500

On Fri, Nov 29, 2019 at 4:12 PM Henk Borsje <address@hidden> wrote:

This question is not of crucial importance, but I’m curious if there is a better alternative.

 

I need to calculate the columnar average of each k points out of an array of x(n,m) elements, resulting in a new array  x_avg (floor (n/k) , m) elements.

 

I use:

 

        tmp = reshape(x,k,[],m);                                      (1)

        x_avg = reshape(mean(tmp),[],m);                  (2)

 

I wonder if there is a simpler or more direct way, except for substituting equation (1) into (2)



just for clarity, can you give a brief example of what your input looks like and what you would like the output to look like?  it seems your method is fairly compact. 

reply via email to

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