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:
sampling from a set based on a condition

Subject: sampling from a set based on a condition

From: enviro leader

Date: 8 Feb, 2009 10:20:02

Message: 1 of 2

question is how to select a sample from a set while the sample variance is maximum?

I want to select a sample of 50 from a while the selected sample has the maximum variance

a=magic(500);a=a(:,1);
b50=?

Subject: sampling from a set based on a condition

From: Roger Stafford

Date: 8 Feb, 2009 18:57:02

Message: 2 of 2

"enviro leader" <farhadnejadkoorki@yahoo.co.uk> wrote in message <gmmbki$f07$1@fred.mathworks.com>...
> question is how to select a sample from a set while the sample variance is maximum?
>
> I want to select a sample of 50 from a while the selected sample has the maximum variance
>
> a=magic(500);a=a(:,1);
> b50=?

  How about selecting the 25 largest and the 25 smallest numbers from 'a'? If these two groups lie on opposite sides of their own mean, you already have the maximum variance. If your set is so skewed that, say, two of these 25 largest happen to lie below their mean, then discard them and add two of the smallest to the sample. Something like that procedure should very quickly get you to the maximum sample variance.

  One thing you can be absolutely sure of. For some number n in 1<=n<=49, if you select the largest n and the smallest 50-n from among the 500, you will attain the maximum sample variance. Very likely this number n will be at or near 25. If necessary you could try all 49 values for n.

  As a matter of curiosity, why would you want to do a thing like that?

Roger Stafford

Tags for this Thread

No tags are associated with 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