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: statistics across multiple dimensions
Replies: 3   Last Post: Apr 20, 2011 7:01 PM

Advanced Search

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

Posts: 39
Registered: 2/4/08
Re: statistics across multiple dimensions
Posted: Apr 20, 2011 7:01 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Thanks. This works.

regs
bala

Doug Schwarz <see@sig.for.address.edu> wrote in message <see-DE124D.23454906042011@news.frontiernet.net>...
> In article
> <8c7d2400-2b78-4af7-b35b-6ad8d96f2064@e9g2000vbk.googlegroups.com>,
> TideMan <mulgor@gmail.com> wrote:
>

> > On Apr 7, 12:10 pm, "Balachander Narasimhan"
> > <balxxxxxch...@whatever.com> wrote:

> > > Hi,
> > >
> > > I have a 3D array. If I need the mean of all elements in two dimensions of
> > > this array, I can do something like
> > >
> > > mean(mean(a,1),2) to average over the first two dimensions of 3D array a
> > > lets say of size 5x5x5
> > >
> > > But I cannot do the same for variance. One of the options seems to be
> > >
> > > for k =1:5
> > > b = a(:,:,k);
> > > v(k) = var(reshape(b,25,1))
> > > end
> > >
> > > Is there a way to avoid this loop?

> >
> > You can do the same with var, only the dimension is the third
> > argument, not the second:
> > var(var(a,0,1),0,2)

>
> No, the mean of the mean is the mean of the whole matrix, but the
> variance of the variance is not the variance of the whole matrix.
>
> To the OP:
>
> a = rand(l,m,n);
> v = var(reshape(a,[],n));
>
> --
> Doug Schwarz
> dmschwarz&ieee,org
> Make obvious changes to get real email address.




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.