Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: matrix mean
Replies: 9   Last Post: Sep 11, 2013 5:13 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,186
Registered: 6/7/07
Re: matrix mean
Posted: Sep 9, 2013 4:41 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 9/9/2013 6:40 AM, Puneet wrote:
> Hi - this is begginers question.
> I have a data set - 16 rows and 16 columns - I would like to average
> every 2 points to get an 8 rows 8 columns matrix.
>
> This is a learning phase so I can run something similar later for larger
> data sets.
> Thanks.


One way...(not necessarily the best :) ) presuming that the "every 2
points" means in both directions given the resulting size of output for
the described input. Similar works w/ filter() for the vector case.

m4=filter2(ones(2)/4,z);
m4=m4(1:2:end,1:2:end);

Hint: look up 2D convolution... :)

accumarray() could be you friend amongst other ways to attack it...

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.