Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!dn9g2000vbb.googlegroups.com!not-for-mail
From: Greg Heath <heath@alumni.brown.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Duplicate matrix by a number of columns
Date: Sat, 14 May 2011 10:43:12 -0700 (PDT)
Organization: http://groups.google.com
Lines: 32
Message-ID: <9e4dfc98-481e-41a8-869f-a12ce61f12c8@dn9g2000vbb.googlegroups.com>
References: <iqmb3e$8v1$1@newscl01ah.mathworks.com> <iqmek0$ihv$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: 69.242.101.137
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1305394992 15377 127.0.0.1 (14 May 2011 17:43:12 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 14 May 2011 17:43:12 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: dn9g2000vbb.googlegroups.com; posting-host=69.242.101.137; posting-account=mUealwkAAACvQrLWvunjg50tRAnsNtJR
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:726820

On May 14, 1:37 pm, "Roger Stafford"
<ellieandrogerxy...@mindspring.com.invalid> wrote:
> "Andy" wrote in message <iqmb3e$8v...@newscl01ah.mathworks.com>...
> > I am a Matlab newbie and  in need help getting some stuff done. My problem is that I A size(106,20503) and matrix B of size (106,1). I want to determine the correlation coefficient of matrix B and all the columns in matrix A. I am not getting any success because the two matrices have different sizes. My idea is to duplicate the columns in matrix B to have the same size as A (106, 20503) whiles keeping the individual elements the same.
>
> > Any ideas how to do this?
>
> > Thanks in advance
>
> > ~ Andy
>
> - - - - - - - - - - - -
>   Why not devise your own correlation computation?  It's simple enough.  Subtract the mean value of each column of A and of B itself from each of their respective elements.  Then divide the resulting elements by the square root of the sum of the squares of the >respective columns.  

help zscore
doc zscore

>Finally you can obtain the correlation by simple matrix multiplication of the resulting revised A2'*B2 to get correlation in a 20503 by 1 column vector.  The 'bsxfun' function is useful in doing >the above.

Hope this helps

Greg