Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
multivariate sample

Subject: multivariate sample

From: eren gümü_

Date: 12 Feb, 2012 12:56:10

Message: 1 of 6

i have this codes;
x1=mvnrnd(mu1,var1,n1);
x2=mvnrnd(mu2,var2,n2);
x=[x1;x2]
x =

    2.1508 -0.8189
    0.3920 -0.5731
    1.8062 3.0157
    1.2171 0.9280
    0.6265 3.6289
    0.1680 0.7567
    1.2869 1.1733
    1.9232 1.8075
    0.8214 0.4894
    0.4783 1.7435
    2.4320 1.8479
    0.1299 0.1701

i want to take all possible samples which have 7 units from x. For example;
sample= 2.1508 -0.8189
             0.3920 -0.5731
             1.8062 3.0157
             1.2171 0.9280
             0.6265 3.6289
             0.1680 0.7567
             1.2869 1.1733
or
 2.1508 -0.8189
 0.3920 -0.5731
 1.8062 3.0157
 1.2171 0.9280
 0.6265 3.6289
 0.1680 0.7567
 1.9232 1.8075

and ... i want all possible samples without replacement. The combination of up to 7 with 12. How can i do this?
Thank you for your answers... (sorry for my english)

Subject: multivariate sample

From: Roger Stafford

Date: 12 Feb, 2012 19:32:10

Message: 2 of 6

"eren gümü_" <erengumus@e-mail.com.tr> wrote in message <jh8cta$hdq$1@newscl01ah.mathworks.com>...
> x =
> 2.1508 -0.8189
> 0.3920 -0.5731
> 1.8062 3.0157
> 1.2171 0.9280
> 0.6265 3.6289
> 0.1680 0.7567
> 1.2869 1.1733
> 1.9232 1.8075
> 0.8214 0.4894
> 0.4783 1.7435
> 2.4320 1.8479
> 0.1299 0.1701
> and ... i want all possible samples without replacement. The combination of up to 7 with 12. How can i do this?
- - - - - - - - -
  Use 'nchoosek'.

Roger Stafford

Subject: multivariate sample

From: eren gümü_

Date: 12 Feb, 2012 19:49:09

Message: 3 of 6

"eren gümü_" <erengumus@e-mail.com.tr> wrote in message <jh8cta$hdq$1@newscl01ah.mathworks.com>...
> i have this codes;
> x1=mvnrnd(mu1,var1,n1);
> x2=mvnrnd(mu2,var2,n2);
> x=[x1;x2]
> x =
>
> 2.1508 -0.8189
> 0.3920 -0.5731
> 1.8062 3.0157
> 1.2171 0.9280
> 0.6265 3.6289
> 0.1680 0.7567
> 1.2869 1.1733
> 1.9232 1.8075
> 0.8214 0.4894
> 0.4783 1.7435
> 2.4320 1.8479
> 0.1299 0.1701
>
> i want to take all possible samples which have 7 units from x. For example;
> sample= 2.1508 -0.8189
> 0.3920 -0.5731
> 1.8062 3.0157
> 1.2171 0.9280
> 0.6265 3.6289
> 0.1680 0.7567
> 1.2869 1.1733
> or
> 2.1508 -0.8189
> 0.3920 -0.5731
> 1.8062 3.0157
> 1.2171 0.9280
> 0.6265 3.6289
> 0.1680 0.7567
> 1.9232 1.8075
>
> and ... i want all possible samples without replacement. The combination of up to 7 with 12. How can i do this?
> Thank you for your answers... (sorry for my english)


nchoosek only choose on a vector not matrix

Subject: multivariate sample

From: Roger Stafford

Date: 12 Feb, 2012 20:01:11

Message: 4 of 6

"eren gümü_" <erengumus@e-mail.com.tr> wrote in message <jh953l$puh$1@newscl01ah.mathworks.com>...
> nchoosek only choose on a vector not matrix
- - - - - - - - -
  Don't use nchoosek on x. Use it on 1:12 to choose all possible combinations of seven subscripts to use as the possible rows of x. (You will have to figure out what to do with all 792 groups of results.)

Roger Stafford

Subject: multivariate sample

From: eren gümü_

Date: 12 Feb, 2012 20:19:10

Message: 5 of 6

"Roger Stafford" wrote in message <jh95q7$rvd$1@newscl01ah.mathworks.com>...
> "eren gümü_" <erengumus@e-mail.com.tr> wrote in message <jh953l$puh$1@newscl01ah.mathworks.com>...
> > nchoosek only choose on a vector not matrix
> - - - - - - - - -
> Don't use nchoosek on x. Use it on 1:12 to choose all possible combinations of seven subscripts to use as the possible rows of x. (You will have to figure out what to do with all 792 groups of results.)
>
> Roger Stafford

thank you but i don't understand. please write the command for me i am not a professional user.

Subject: multivariate sample

From: Roger Stafford

Date: 12 Feb, 2012 21:04:10

Message: 6 of 6

"eren gümü_" <erengumus@e-mail.com.tr> wrote in message <jh96ru$1ga$1@newscl01ah.mathworks.com>...
> thank you but i don't understand. please write the command for me i am not a professional user.
- - - - - - - -
  I won't write all your code for you. (I don't even know how you wish to dispose of your results.) However, suppose that one of the rows from 'nchoosek' was r =[2,3,5,6,8,10,12]. You could get the the corresponding portion of x using:

 s = x(r,:)

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us