From: Frank Sabouri on
Hi:

There is a matrix that is "x" [different conditions (168)-by-variables (9)]. You suppose that I made 28 different sub-matrices from "x", wherein size of each sub-matrix is (6-by-9). I want to compute Euclidean distances among 9 variables for any given sub-matrix.

X (:,:,:)=subdivide (x,6,9); % size of cell is (6,9,28)
for i = 1:28,
[Y] = pdist (X(:,:,i)');
Ym=mean (Y) ;
Z=linkage(Ym,'average');
end

May please somebody show me where the problem is.

Thanks,

Frank


From: Matt Fetterman on
"Frank Sabouri" <Frank.Sabouri(a)gmail.com> wrote in message <hhmifj$q68$1(a)fred.mathworks.com>...
> Hi:
>
> There is a matrix that is "x" [different conditions (168)-by-variables (9)]. You suppose that I made 28 different sub-matrices from "x", wherein size of each sub-matrix is (6-by-9). I want to compute Euclidean distances among 9 variables for any given sub-matrix.
>
> X (:,:,:)=subdivide (x,6,9); % size of cell is (6,9,28)
> for i = 1:28,
> [Y] = pdist (X(:,:,i)');
> Ym=mean (Y) ;
> Z=linkage(Ym,'average');
> end
>
> May please somebody show me where the problem is.
>
> Thanks,
>
> Frank
>
>

Perhaps you could explain what the error is that you are getting or how it is going wrong?
Regards Matt
From: Frank Sabouri on
"Matt Fetterman" <mattinjersey(a)yahoo.com> wrote in message <hhmkfd$t5s$1(a)fred.mathworks.com>...
> "Frank Sabouri" <Frank.Sabouri(a)gmail.com> wrote in message <hhmifj$q68$1(a)fred.mathworks.com>...
> > Hi:
> >
> > There is a matrix that is "x" [different conditions (168)-by-variables (9)]. You suppose that I made 28 different sub-matrices from "x", wherein size of each sub-matrix is (6-by-9). I want to compute Euclidean distances among 9 variables for any given sub-matrix.
> >
> > X (:,:,:)=subdivide (x,6,9); % size of cell is (6,9,28)
> > for i = 1:28,
> > [Y] = pdist (X(:,:,i)');
> > Ym=mean (Y) ;
> > Z=linkage(Ym,'average');
> > end
> >
> > May please somebody show me where the problem is.
> >
> > Thanks,
> >
> > Frank
> >
> >
>
> Perhaps you could explain what the error is that you are getting or how it is going wrong?
> Regards Matt

Hi Matt:

Actually, I expected to get an output (Y) that is a matrix (28-by-36) that depicts Euclidean distances for 28 different sub-matrices; however, the output is only a vector that shows Euclidean distances for only one of sub-matrices which is number 28.

Cheers,

Frank
From: Matt Fetterman on
"Frank Sabouri" <Frank.Sabouri(a)gmail.com> wrote in message <hhmnvu$7a4$1(a)fred.mathworks.com>...
> "Matt Fetterman" <mattinjersey(a)yahoo.com> wrote in message <hhmkfd$t5s$1(a)fred.mathworks.com>...
> > "Frank Sabouri" <Frank.Sabouri(a)gmail.com> wrote in message <hhmifj$q68$1(a)fred.mathworks.com>...
> > > Hi:
> > >
> > > There is a matrix that is "x" [different conditions (168)-by-variables (9)]. You suppose that I made 28 different sub-matrices from "x", wherein size of each sub-matrix is (6-by-9). I want to compute Euclidean distances among 9 variables for any given sub-matrix.
> > >
> > > X (:,:,:)=subdivide (x,6,9); % size of cell is (6,9,28)
> > > for i = 1:28,
> > > [Y] = pdist (X(:,:,i)');
> > > Ym=mean (Y) ;
> > > Z=linkage(Ym,'average');
> > > end
> > >
> > > May please somebody show me where the problem is.
> > >
> > > Thanks,
> > >
> > > Frank
> > >
> > >
> >
> > Perhaps you could explain what the error is that you are getting or how it is going wrong?
> > Regards Matt
>
> Hi Matt:
>
> Actually, I expected to get an output (Y) that is a matrix (28-by-36) that depicts Euclidean distances for 28 different sub-matrices; however, the output is only a vector that shows Euclidean distances for only one of sub-matrices which is number 28.
>
> Cheers,
>
> Frank

Hi Frank, The problem is with your loop. The loop cycles through different values of i and you will want to assign the output of each time you run the loop to a different variable or a different spot in the output matrix. For example,
P(i,1:10)=Z;

Regards! Matt
From: Frank Sabouri on
"Matt Fetterman" <mattinjersey(a)yahoo.com> wrote in message <hhmp1i$bc2$1(a)fred.mathworks.com>...
> "Frank Sabouri" <Frank.Sabouri(a)gmail.com> wrote in message <hhmnvu$7a4$1(a)fred.mathworks.com>...
> > "Matt Fetterman" <mattinjersey(a)yahoo.com> wrote in message <hhmkfd$t5s$1(a)fred.mathworks.com>...
> > > "Frank Sabouri" <Frank.Sabouri(a)gmail.com> wrote in message <hhmifj$q68$1(a)fred.mathworks.com>...
> > > > Hi:
> > > >
> > > > There is a matrix that is "x" [different conditions (168)-by-variables (9)]. You suppose that I made 28 different sub-matrices from "x", wherein size of each sub-matrix is (6-by-9). I want to compute Euclidean distances among 9 variables for any given sub-matrix.
> > > >
> > > > X (:,:,:)=subdivide (x,6,9); % size of cell is (6,9,28)
> > > > for i = 1:28,
> > > > [Y] = pdist (X(:,:,i)');
> > > > Ym=mean (Y) ;
> > > > Z=linkage(Ym,'average');
> > > > end
> > > >
> > > > May please somebody show me where the problem is.
> > > >
> > > > Thanks,
> > > >
> > > > Frank
> > > >
> > > >
> > >
> > > Perhaps you could explain what the error is that you are getting or how it is going wrong?
> > > Regards Matt
> >
> > Hi Matt:
> >
> > Actually, I expected to get an output (Y) that is a matrix (28-by-36) that depicts Euclidean distances for 28 different sub-matrices; however, the output is only a vector that shows Euclidean distances for only one of sub-matrices which is number 28.
> >
> > Cheers,
> >
> > Frank
>
> Hi Frank, The problem is with your loop. The loop cycles through different values of i and you will want to assign the output of each time you run the loop to a different variable or a different spot in the output matrix. For example,
> P(i,1:10)=Z;
>
> Regards! Matt

Hi Matt,

I tried to insert your comment on the loop. Please let me know if it is what I should do.

for i = 1:28,
[Y] = pdist (X(:,:,i)');
P(i,1:28)=28;
end

Ym=mean (Y) ;
Z=linkage(Ym,'average');

Regadrs,
Farnk
 |  Next  |  Last
Pages: 1 2
Prev: smes unit
Next: Slow/Fast Rayleigh Fading