Question:Compare two methods for finding the steady-state vector q of a regular stochastic matrix P: (1) computing q as in Example 5, or (2) computing\({P^k}\)for some large value of\(k\)and using one of the columns of\({P^k}\)as an approximation for q. [The Study Guidedescribes a program nulbasisthat almostautomates method (1).]

Experiment with the largest random stochastic matrices your matrix program will allow, and use\(k = 100\)or some other large value. For each method, describe the time you need to enter the keystrokes and run your program. (Some versions of MATLAB have commands flops and tic … toc that record the number of floating point operations and the total elapsed time MATLAB uses.) Contrast theadvantages of each method, and state which you prefer.

Short Answer

Expert verified

The second method is preferable.

Step by step solution

01

 Step 1: State the stochastic matrix

Use the MATLAB command to construct a random stochastic matrix as shown below:

\(\begin{array}{l} > > functionP = randstoc\left( n \right)\\ > > M = rand\left( n \right);\\ > > P = M/\left( {ones\left( {n,1} \right)*sum\left( M \right)} \right)\end{array}\)

Use the MATLAB command to construct a nulbasis as shown below:

\(\begin{array}{l} > > functionN = nulbasis\left( A \right)\\ > > \left[ {R,pivcol} \right]*rref\left( {A,sqrt\left( {eps} \right)} \right);\\ > > \left[ {m,n} \right] = size\left( A \right);\\ > > r = length\left( {pivcol} \right);\end{array}\)

02

Find the steady-state vector

Use the MATLAB command to construct a steady-state vector as shown below:

\(\begin{array}{c} > > A = randstoc\left( {32} \right);flops\left( 0 \right);\\ > > tic,x = nulbasis\left( {A - eye\left( {32} \right)} \right);\\ > > q = x/sum\left( x \right);toc,flops\end{array}\)

The elapsed time is 0.064004 seconds.

Use the MATLAB command to construct a steady-state vector by another method as shown below:

The elapsed time is 0.310368 seconds.

The second method (MATLAB command) is preferable.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free