Download presentation

Presentation is loading. Please wait.

Published byNash Turner Modified over 2 years ago

1
Markov chains

2
Probability distributions

3
Exercise 1.Use the Matlab function nchoosek(n,k) to implement a generic function BinomialPMF(k,n,p) for calculating the Binomial PMF with k successes in n trials with probability p. 2.Use the barplot function to plot the pmf values (k=0..10) for Bin(10,0.5) as below:

4
Markov chains

6
Example: A very simple weather model (modified from Wikipedia page Examples of Markov chains) The probabilities of weather conditions, modeled as either sunny=0 or rainy=1, given the weather on the preceding day, can be represented by a transition matrix

7
Weather model example The matrix P represents the weather model in which a sunny day is 90% likely to be followed by another sunny day, and a rainy day is 50% likely to be followed by another rainy day. The columns can be labelled sunny and rainy respectively, and the rows can be labelled in the same order. P ij is the probability that, if a given day is of type i, it will be followed by a day of type j. Note that the rows of P add up to 1: sum(P)

8
Weather model example

9
Exercise If the the weather on the first day has 50% probability of being sunny or rainy, then what is the probability of the ninth day being sunny? What about the 30 th day?

10
Weather model example

11
Eigenvectors / Eigenvalues

12
We can calculate eigenvalues and eigenvectors in Matlab using the built-in function eig. The default behavior is for right eigenvalues/eigenvectors, but left eigenvalues/eigenvectors are easily obtained by transposing the matrix. We will be using the form (from Matlab help for eig): [V,D] = eig(A) produces matrices of eigenvalues (D) and eigenvectors (V) of matrix A, so that A*V = V*D. Matrix D is the canonical form of A a diagonal matrix with As eigenvalues on the main diagonal. Matrix V is the modal matrix - its columns are the eigenvectors of A. Note that Matlab always returns eigenvectors with norm 1.

13
Exercise 1.Use the eig function to find out, in the long term, what is the percentage of sunny days in the weather example.

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google