#### Here is my Introduction to MATLAB for Math 151 students (Postscript file - 12 pages)

#### Here is the list of all MATLAB Files below with a brief description of each (Text file)

#### Longer MATLAB Primer (Postscript file 213KB)

#### Here are some additional MATLAB files used for other courses

#### lesson1.m - Plots leaf length and width histograms from data in l and w as well as graphs length vs. width (MATLAB .m file)

#### lesson2.m - Compares plots of leaf length and width and regressions of these for two different data sets: l and w vs. l3 and w3 stored in file leafstat.dat (MATLAB .m file)

#### lesson3.m - Using data on fat intake and artherosclerosis death rate in Norway, computes the regression line and correlation coefficient (MATLAB .m file)

#### lesson3b.m - Using data in correlat.mat this illustrates difference in linear regression when graphing x against y rather than y against x. (MATLAB .m file)

#### lesson3c.m - Using data in semilog.dat this illustrates the ability to do a linear regression on a semilog plot (MATLAB .m file)

#### lesson3d.m - Using data in loglog.dat this illustrates the ability to do a linear regression on a loglog plot (MATLAB .m file)

#### lesson4.m - Using data in co2dat.sh which gives Maona Loa atmospheric CO2 concentration annual averages from 1970-1990, this computes linear regression and estimates CO2 in years 2000 and 2100. (MATLAB .m file)

#### co2plot.m - Using data in co2datmo.dat which gives Maona Loa atmospheric CO2 concentration monthly data from 1965-1970, this just shows plot to illustrate heartbeat of the planet. (MATLAB .m file)

#### project2.m - Using data collected by the user in vectors d1 and d2, this calculates all the histograms, plots and regressions necessary to do Project 2 for the course. (MATLAB .m file)

#### marsucc.m - This illustrates eigenvalues and eigenvectors arising from a landscape vegetation succession Markov Chain similar to that visualized in the Ecobeaker Intermediate disturbance model, but with only three landscape types (Bare soil, grass and shrub). It compares the long-term fraction of landscape in each state to the eigenvector for 3 different vegetation succession matrices. (MATLAB .m file)

#### lesson5.m - This illustrates eigenvalues and eigenvectors arising from a population projection model. It compares growth rate as measured by the eigenvalue to that from projecting the population forward 10 and 20 time periods. (MATLAB .m file)

#### bdayprob.m.m - Calculates the solution of the birthday problem - the probability at least two individuals in a group have the same birthday. (MATLAB .m file)

#### binomial.m - Simulates a binomial distribution corresponding to coin tosses and compares theoretical mean and variance to that simulated. (MATLAB .m file)

#### coints.m - Simulates n tosses of a coin with probability p of getting a Head and 1-p of getting a Tail (MATLAB .m file)

#### ordersta.m - Simulates tosses of a coin with probability p of getting a Head and 1-p of getting a Tail and counts the time until the kth Head occurs. That is, this computes the kth order statistics. (MATLAB .m file)

#### urn.m - Simulates an urn with two-types of balls (1 and 2) and the rules are: choose a ball, replace the ball with itself and one other of the same type, repeat process. A Polya-urn scheme. (MATLAB .m file)

#### levelcrs.m - Simulates tosses of a coin with probability p of getting a Head and 1-p of getting a Tail and counts the time until either the kth Head occurs or the mth Tail. A level-crossing problem. (MATLAB .m file)

#### level2.m - Simulates tosses of a coin with probability p of getting a Head and 1-p of getting a Tail and determines the fraction of experiments in which k heads occur before m tails occur. Another level crossing example. (MATLAB .m file)

#### ranleslie.m - Simulates a population projection model in a random environment. It computes geometric mean growth rates computed over an 80 time step period, and final population size, when adult fecundity is chosen from a uniform distribution. This process is simulated 200 times and histograms are produced for the results. (MATLAB .m file)

#### ranles2.m - Simulates a population projection model in a random environment. It computes geometric mean growth rates computed over an 80 time step period, and final population size, when adult fecundity is chosen from a uniform distribution. This process is simulated 200 times and histograms are produced for the results. This version does not use the Matlab geomean function. (MATLAB .m file)

#### exponen.m - Solves the discrete linear growth equation x(i+1)=a*x(i)+b (MATLAB .m file)

#### analog.m - Solves the discrete analog of the continuous logistic growth model x(i+1)=r*x(i)/(1+x(i)) (MATLAB .m file)

#### logistic.m - Solves the discrete logistic equation x(i+1)=r*x(i)*(1-x(i)) (MATLAB .m file)

#### selectio.m - Simulates selection in a one locus two allele model, with random mating, infinite population size, no mutation (MATLAB .m file)

#### secdiff.m - Solves general homogeneous second order difference equations of the form a x(n+1) + b x(n) + c x(n-1) = 0 (MATLAB .m file)

Below are the data files used as input for some of the above .m files. Files with extension .dat and .mat are MATLAB data files, not ASCII text, so save them to a file to use them. #### leafstat.dat - leaf length and width data used in lesson1.m and lesson2.m (MATLAB data file)

#### fatdead.dat - fat intake data used in lesson3.m (MATLAB data file)

#### correlat.mat - data used in lesson3b.m to illustrate linear regression (MATLAB data file)

#### semilog.dat - data used in lesson3c.m to illustrate semi-log linear regression (MATLAB data file)

#### loglog.dat - data used in lesson3d.m to illustrate log-log linear regression (MATLAB data file)

#### co2dat.sh - data used in lesson4.m giving annual CO2 concentrations for 20 years (ASCII data file)

#### co2datmo.dat - data used in co2plot.m giving monthly CO2 concentrations for 5 years (MATLAB data file)

#### co2dat.mon - ASCII data used in co2plot.m giving monthly CO2 concentrations for 5 years (ASCII data file)

*Return to***Quantitative Curriculum for Life Sciences Home Page**

*Return to***L. Gross Home Page**

`http://www.tiem.utk.edu/~gross/`