# Mean, variance, and histograms

 Page 2 / 2

## Exercise 2.2

Suppose you have set the goal of making an A in your math class. If your class grades consist of 4 tests, and you have made a 98, 80, and 90 on your first three tests, what do you need to make on your last test so that the mean of your grades is 90?

## Exercise 2.3

(for the advanced) Suppose that, for the same class, you have already computed the mean of the first three tests when you receive your fourth test grade. Instead of computing the mean of all four tests from scratch, it's possible to update the mean that you've already computed. Write a Matlab code that takes two inputs, the mean of your first three tests and the grade of your fourth test, and computes the mean of all four tests.

## Variance and standard deviation

As you saw in "Example 2.2" , the mean is not always representative of the data, and other measures are needed to analyze the spread of the data. The variance is a measure of the distance of each number from the mean. Given a vector x of n numbers and mean value $\overline{x},$ the variance of x is given by

$\mathrm{var}\left(\mathbf{x}\right)=\frac{1}{n-1}\sum _{k=1}^{n}{\left({\mathbf{x}}_{k}-\overline{x}\right)}^{2}=\frac{{\left({\mathbf{x}}_{1}-\overline{x}\right)}^{2}+{\left({\mathbf{x}}_{2}-\overline{x}\right)}^{2}+...+{\left({\mathbf{x}}_{n}-\overline{x}\right)}^{2}}{n-1}.$

The standard deviation of the data is related to the variance and is given by

$\mathrm{std}\left(\mathbf{x}\right)=\sqrt{\mathrm{var}\left(\mathbf{x}\right)}.$

You can compute the variance and standard deviation of x in Matlab by typing the commands var(x) and std(x).

## Example 3.1

Consider the vector given in "Example 2.1" , x = [1, 7, 2, 5, 9, 6]. Recall that the mean of x = 5.

$\mathrm{var}\left(\mathbf{x}\right)=\frac{{\left(1-5\right)}^{2}+{\left(7-5\right)}^{2}+{\left(2-5\right)}^{2}+{\left(5-5\right)}^{2}+{\left(9-5\right)}^{2}+{\left(6-5\right)}^{2}}{5}=9.2$
$\mathrm{std}\left(\mathbf{x}\right)=\sqrt{\mathrm{var}\left(\mathbf{x}\right)}\simeq 3.03$

## Example 3.2

Consider the data from "Example 2.2" , where the mean $\overline{x}$ = 300. The variance is

$\mathrm{var}\left(\mathbf{x}\right)=\frac{16·{\left(100-300\right)}^{2}+3·{\left(900-300\right)}^{2}+{\left(1700-300\right)}^{2}}{13}\simeq 193,684$

and the standard deviation is

$\mathrm{std}\left(\mathbf{x}\right)=\sqrt{\left(\mathrm{var}\left(\mathbf{x}\right)\right)}\simeq 440$

Because the standard deviation is considerably larger than the mean, the variance tells us that the mean is not very representative of the data.

## Exercise 3.1

Compute the variance and standard deviation of y = [3, 8, 2, 5, 5, 7], using both the formulas and the Matlab commands.

## Exercise 3.2

Suppose that in the situation of "Example 2.2" , there are 50 general exmployees instead of 16. Compute the mean and variance of the daily salary. Is the mean more or less representative of the data than it was in Example 2.2?

## Histograms

Although the mean, variance, and standard deviation provide information about the data, it is often useful to visualize the data. A histogram is a tool that allows you to visualize the proportion of numbers that fall within a given bin, or interval. To compute the histogram of a set of data, x , follow the algorithm below.

1. Choose the bin size $\Delta x$ . The bins are the intervals [0, $\Delta x$ ], ( $\Delta x$ , 2 $\Delta x$ ], (2 $\Delta x$ , 3 $\Delta x$ ], and so on.
2. For each bin, count the number of data points that lie within the bin.
3. Create a bar graph showing the number of data points within each bin.

## Example 4.1

Consider again the vector from "Example 2.1" , x = [1, 7, 2, 5, 9, 6]. Using a bin size $\Delta x$ = 2, there are 5 bins.

• Bin 1 = [0, 2] has 2 elements of x
• Bin 2 = (2, 4] has 0 elements of x
• Bin 3 = (4, 6] has 2 elements of x
• Bin 4 = (6, 8] has 1 element of x
• Bin 5 = (8, 10] has 1 element of x

In Matlab, you can plot the histogram of a vector x by typing hist(x). Matlab will automatically use 10 bins. If you'd like to specify the bin centers, type hist(x,c), where c is a vector of bin centers. The histogram of "Example 4.1" was generated by the Matlab command hist(x, [1, 3, 5, 7, 9]).

## Exercise 4.1

Plot the histogram of the vector y = [3, 8, 2, 5, 5, 7], both on paper and in Matlab.

## Exercise 4.2

Plot the histogram of the daily salaries from "Example 2.2" . For this example, does the histogram or the mean give you a better idea of what salary you would be making if you got the job?

where we get a research paper on Nano chemistry....?
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
Got questions? Join the online conversation and get instant answers!
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 15, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}