CS 1173 Computation for Scientists and Engineers
Data Analysis and Visualization Using MATLAB
Lesson summary

Lesson Title and links Analysis/visualization conceptsMATLAB/computing concepts
1 Editing plots
Lesson     Questions

FOCUS QUESTION: How do I start using MATLAB?
  • Arrays as tables with rows and columns
  • Plotting the columns of an array against the integers from 1:n
  • Requirements for a well-designed plot
  • MATLAB environment and windows (Command, History, Workspace, Editor)
  • Changing the current directory
  • Loading data
  • Saving and opening figures
  • Edit mode and the plot tools
  • Creating and running MATLAB scripts
  • Using MATLAB cell mode
  • The plot command
2 Working with line graphs
Lesson     Script     Questions

FOCUS QUESTION: How do I display trends in data?
  • Different ways to use line graphs
  • Plotting summary information rather than individual data points
  • Setting explicit x-axis values using x-y plots
  • Using colons to specify ranges
  • Using the linear representation of an array to extract data in a particular order
  • The sum function for adding up rows or columns
  • The transpose operator (') for flipping an array
  • Using array division (./)
  • Inserting legends and labels using code rather than by plot editing
  • Using hold on and hold off to display multiple graphs on the same axis.
3 Pie and bar charts
Lesson     Script     Questions

FOCUS QUESTION: How can I show proportions and relative sizes of different data groups?
  • Pie charts for displaying relative proportions
  • Bar charts for displaying both proportion and magnitude
  • Grouped or stacked bar charts for comparing multiple data sets
  • Scaling a data set to make the axes more understandable
  • First discussion of color
  • Additional practice with the sum function
  • Using square brackets and commas to assemble an array
  • Additional examples of use of transpose and array assembly
  • The pie function for creating a pie chart
  • The bar and barh functions for creating vertical and horizontal bar charts
  • The stack option of the bar function
  • The colormap function for changing the color scheme of a figure
4 Subplots, multiple axes, and insets
Lesson     Script     Questions

FOCUS QUESTION: How can I combine graphs to make effective comparisons?
  • Different strategies for combining plots (insets, subplots and double axis)
  • Displaying multiple graphs of different sizes to focus attention
  • Overlaying graphs using different scales to compare trends
  • Using the plot-browser to edit and select plots in MATLAB
  • The subplot function for tiling axes
  • Creating an inset plot using the insert axis feature
  • The plotyy function for creating a plot with two vertical axes
  • Using axis and plot handles to modify graph properties
5 Basic statistical indicators
Lesson     Script     Questions

FOCUS QUESTION: How can I find typical characteristics and central tendencies of data?
  • Statistical indicators: mean, median, maximum and minimum
  • Outputing information about a data set
  • The mean, median, max, and min functions for expressing basic statistical characteristics
  • The fprintf functions for outputting data
  • The linspace function to create an array of equally linearly points
  • Developing a function to perform repeated actions on different data
6 Scatter plots, curve fitting and correlation
Lesson     Script     Questions

FOCUS QUESTION: How can I determine whether two variables are related?
  • Computing the correlation between two data sets
  • Comparing two data sets by plotting them against each other in a scatter plot
  • Computing the best fit line
  • Evaluating the RMS (root mean squared) error between predictions and actual data
  • Adding a linear fit line to a scatter plot using the MATLAB plottools
  • Constructing strings for plot annotation
  • Using xlabel, ylabel, and title to directly annotate a plot
  • The corr function for computing correlations
  • The polyfit function for fitting a polynomial to data
  • The polyval function for evaluating a polynomial at an array of points
7 Rates of change
Lesson     Script     Questions

FOCUS QUESTION: How can I characterize rates of change?
  • Calculating slope, rate of change, or derivative of data
  • Displaying the slope over plotted with the function to emphasize features
  • Plotting data in multiple ranges on the same graph
  • Using gridlines to facilitate reading the graph
  • Calculating per capita growth rates for comparison in different populations
  • Calculating interval midpoints by averaging lower ends with the upper ends
  • The diff function for computing adjacent differences
  • Using a ratio of diff functions to approximate the slope
  • Using end notation in array index selection
  • Dividing a ratio of diff functions by the population to find the growth rate per capita or rate of change per capita
  • Practicing with concepts of previous lessons
8 Vector logic for specializing plots
Lesson     Script     Questions

FOCUS QUESTION: How can I extract the rows and columns of an array based on data characteristics?
  • Using logical operators to pick out subsets of the data
  • Using relational operators to compare data and set ranges
  • Using logical operators & (and), | (or), ~ (not) to express conditions on the data
  • Using vector indexing (logical vectors as array indexes) to select rows or columns
  • Using relational operators < (less than), <= (less than or equal), > (greater than), >= (greater than or =), == (equal), and ~= (not equal) to compare data values.
9 Program control
Lesson     Script     Questions

FOCUS QUESTION: How can I execute different code depending on the data?
  • Coin tossing and random walk
  • Keeping a running sum to find totals
  • Expressing alternative actions
  • Repeating actions under slightly different conditions
  • Using the rand function to pick a value at random
  • Using if and if-else to express alternative actions
  • Using for to repeat a set of actions
  • The find function for discovering the position of particular values
10 Histograms
Lesson     Script     Questions

FOCUS QUESTION: How can I understand and compare the distributions of two data sets?
  • Using histograms to convey distribution characteristics
  • Computing the cumulative probability distribution
  • Comparing the characteristics of common distributions (normal, uniform and exponential)
  • Scaling histograms to show the fraction of values rather than the number of values
  • The hist function for computing frequency tables
  • The stairs function for displaying a stair plot
  • Setting the number of bins and bin positions for a histogram
  • The random function for generating pseudo-random values from a specified distribution
11 Box plots
Lesson     Script     Questions

FOCUS QUESTION: How can I compare the distributions of data sets that have outliers?
  • Comparing distributions using box plots
  • Computing relative data set sizes
  • Observing medians and IQRs
  • The boxplot function for showing distributions
  • Using labeled data in box plots
  • Other variations of the box plots
  • The repmat function
12 Error bars
Lesson     Script     Questions

FOCUS QUESTION: How can I depict uncertainty and variability in data?
  • Using error bars to depict spread
  • Using error bars on bar charts
  • Computing and interpreting standard error of the mean (SEM)
  • Creating SD, SEM and IQR error bars
  • The errorbar function and its variations
  • Using gca to get and set axis properties
13 Depicting confidence
Lesson     Script     Questions

FOCUS QUESTION: How reliable is my estimate of population mean?
  • Using error bars to depict confidence intervals
  • Averaging to extract trends and reduce noise
  • Using reshaping arrays to average in different ways
14 Tests for normality or other distributions
Lesson     Script     Questions
  • Testing for normality through visual and computational tests
  • The normplot function for visually testing normality
  • The lilliefors function to test for normality
15 Hypothesis testing
Lesson     Script     Questions
  • Formulating a testable hypothesis
  • One-sided and two-sided hypothesis tests
  • Understanding significance levels and p-values
  • The ttest for testing population mean
  • The ttest2 for comparing population means
  • Using p-values and confidence intervals to obtain additional detail
16 Logarithmic scales
Lesson     Script     Questions

FOCUS QUESTION: How can I use logarithmic scales to understand rates of growth?
  • Calculating slope of data expressed on linear and logarithmic scales
  • Plotting data on various types of logarithmic axes
  • Examining rates of growth
  • Performing a linear fit and finding the R2 to characterize the quality of the fit.
  • Finding per capita growth rates
  • The semilogx and semilogy functions
  • The loglog function
  • Examining rates of growth
17 Modeling the heart
Lesson     Script     Questions
   
18 Working with dates
Lesson     Script     Questions
   
19 Input and output
Lesson     Script     Questions
   

This course summary was written by Kay A. Robbins of the University of Texas at San Antonio and last modified on 31-Dec-2011. Please contact krobbins@cs.utsa.edu with comments or suggestions.