Use the following code to generate a random transition matri

Use the following code to generate a random transition matrix of a Markov chain on 10 states P = rand(10, 10); for j =1:10 colsum = suiii(P(:, j)); P(:, j)=P(:, j)/colsum; end

Solution

as its not mentioned which language to write i am ust writing in C++, let me know if understood the question incorrectly

#include<iostream.h>

#include<conio.h>

#include<stdlib.h>

void main()

{

P = rand(10,10);

for(j=1;j<=10;j++)

{

colsum = sum(P(:,j));
P(:,j) = P(:,j)/colsim;

}

}

 Use the following code to generate a random transition matrix of a Markov chain on 10 states P = rand(10, 10); for j =1:10 colsum = suiii(P(:, j)); P(:, j)=P(:

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site