MATLAB Examples

Summer Olympic Medals 1896-present

by Bill McKeeman August 17, 2008

Various looks at the medal counts of the Summer Olympics


How it works

The olympic medal records are recorded in scripts summerYYYY.m. Another script, allSummers, places values in the workspace

  • medals(i,j) is a record of medals for team i in olympiad j
  • hosts(j) is the name of the host nation of olympiad j
  • sites(j) is the name of the host city of olympiad j
  • teamobj give the correlation between team i and its text name
allSummers  % set up data

Varieties of analysis

There are many questions of interest, depending somewhat on who you are and where you come from. I have coded up a few as examples. I presume that you, the user, will code up your own. Here is where the olympics have been or were planned to be (some were cancelled; some were boycotted.).

listSites(hosts, sites)
1896 Athens, Greece
1900 Paris, France
1904 St. Louis, United States
1908 London, Great Britain
1912 Stockholm, Sweden
1916 Berlin, Germany
1920 Antwerp, Belgium
1924 Paris, France
1928 Amsterdam, Netherlands
1932 Los Angeles, United States
1936 Berlin, Germany
1940 Tokyo, Japan
1944 London, Great Britain
1948 London, Great Britain
1952 Helsinki, Finland
1956 Melbourne, Australia
1960 Rome, Italy
1964 Tokyo, Japan
1968 Mexico City, Mexico
1972 Munich, West Germany
1976 Montreal, Canada
1980 Moscow, Soviet Union
1984 Los Angeles, United States
1988 Seoul, South Korea
1992 Barcelona, Spain
1996 Atlanta, United States
2000 Sydney, Australia
2004 Athens, Greece
2008 Beijing, China

The number of medals

As it happens, the number of sporting events and therefore the number of medals has been increasing over time. Did you know that Tug Of War was once an olympic sport? Here is the plot.


Comparing records

Comparing the records of traditional rivals, say France and Great Britain, over time is sometimes interesting. Here is a comparison of totals medals in each Olympiad for the United States, China, Russia and the Soviet Union:

plotCountryMedals(medals, teamobj, ...
  {'China', 'Soviet Union', 'Unified Team', 'Russia', 'United States'});


The team ranks can be computed for the entire set of medal winning teams. One ranking is based on gold first, silver second, then bronze. Another is on total medals. Here are these rankings:

rank1 = rankGSB(medals);
listRanks(rank1, teamobj, games(1900));
Olympiad II
1 France
2 United States
3 Great Britain
4 Mixed team
5 Switzerland
6 Belgium
7 Germany
8 Italy
9 Australia
10 Denmark
11 Hungary
12 Cuba
13 Canada
14 Spain
15 Austria
16 Norway
17 India
18 Netherlands
19 Bohemia
20 Mexico
20 Sweden
rank2 = rankTotalMedals(medals);
listRanks(rank2, teamobj, games(1900));
Olympiad II
1 France
2 United States
3 Great Britain
4 Belgium
5 Mixed team
6 Switzerland
7 Germany
8 Austria
8 Denmark
10 Hungary
10 Australia
10 Norway
13 Italy
13 Netherlands
15 Cuba
15 Canada
15 India
15 Bohemia
19 Spain
19 Mexico
19 Sweden

Final comments

The data in each file summerYYYY.m is hand-transcribed from wikipedia. There could be errors. I will, of course, correct errors that are brought to my attention.

Related Sites

Graphics of country versus gold medals over time

Sports Illustrated Bar Graph of Medals/Olympiad