- Basic Matlab tutorials for biochemistry students, specifically designed for this class.
- Zip file of the Matlab tutorials (Instructions1.pdf and Instructions2.pdf) and associated Matlab program files.

The links below are outdated. Download the zip file above and use the instructions there.

Note: some browsers display the Matlab program files below as if they had no carriage returns; in this case, either save the page to view it locally or use View, Page Source.

- show(S,N) uses letters N to show states S
- rando(x) returns a random integer distributed according to probability vector x
- rna_iid(n) generates n independent, identically distributed RNA bases

- rna_mar(n) generates n RNA bases with Markov dependence
- transition_count(x,N) makes a table of transitions of x and labels the states using letters in the string N

- die_mar alternates between fair and loaded die rolls
- hmmsim(mu,A,n) generates n states of a Markov chain with initial distribution mu and transition matrix A.
- obssim(Pi,E) generates emitted states based on hidden sequence Pi using emission probabilities E.
- viterbi(mu,A,E,X) uses the Viterbi algorithm to find the most likely hidden state sequence associated with the data in matrix X, where mu is the initial distribution of hidden states, A is the transition matrix, and E is the matrix of emission probabilities.
- dice(n,r) alternates between fair and loaded dice, runs r simulations of length n each, and estimates the hidden sequence. The actual hidden sequence is shown first, then the observed sequences, then the estimated sequence, with errors marked below.
- dice(78,1) output
- dice(78,2) output
- dice(78,3) output
- dice(78,5) output
- dice(78,10) output
- dice(78,20) output

- canonical_loop(n) makes a loop of n RNA bases with canonical base pairs
- noncanonical_loop(n) makes a loop of no more than n RNA bases with noncanonical base pairs and insertions
- rna_loops(n,L) generates an RNA loop of length about n with about L additional loops inserted at random places
- Output of several runs of canonical_loop(40)
- Output of several runs of rna_loops(40,4)