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: taking the mean of a matrix
Replies: 2   Last Post: Dec 5, 2012 6:43 PM

Advanced Search

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

Posts: 5,996
Registered: 2/7/05
Re: taking the mean of a matrix
Posted: Dec 5, 2012 6:43 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 12/5/2012 5:37 PM, Nasser M. Abbasi wrote:
> On 12/5/2012 5:19 PM, David wrote:
>> I am trying to figure out how to make a for loop that will take the mean
>> of every, say n values, of a single column matrix...
>> So say I have a matrix that is b(54,1), and I make n = 4, I want
>> the loop to take the mean of values 1-4, 5-8, 9-12, and so on.

> what will happen when we get to 44-48, 49-52, then what about
> the last 2? ok to take just the mean of what is left? or you
> want an error for this?

assuming matrix is meant to be (52,1) so it divids OK, then
may be :

N = 52;
n = 4;
V = rand(N,1);


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

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.