Answered step by step
Verified Expert Solution
Question
1 Approved Answer
More on Matrices; Application Difficulty: Moderate EXERCISE6 (6 points) Theory: A vector with nonnegative entries is called a probability vector if the sum of its
More on Matrices; Application Difficulty: Moderate EXERCISE6 (6 points) Theory: A vector with nonnegative entries is called a probability vector if the sum of its entries is 1. A square matrix is called right stochastic matrix if its rows are probability vectors; a square matrix is called a left stochastic matrix if its columns are probability vectors; and a square matrix is called a doubly stochastic matrix if both the rows and the columns are probability vectors **Write a MATLAB function function P-stochastic (A) which accepts a square matrix A with nonnegative entries as an input. The output will be a stochastic matrix P as defined below. You should use the row vectors S1=sum(A,I) and S2-transpose(sum(A,2)) in your code along with the conditional "if" statements. You could also employ a logical function all **First, the function has to check whether a matrix A contains both a zero column and a zero row. If yes, the output has to be a message A is not stochastic and cannot be scaled to stochastic". (Meaning: it is neither right- nor left-stochastic and cannot be scaled to either of them.) The outputs in this case are S1, S2, and P [ ] **Then, the function checks whether a matrix A is: (1) doubly stochastic, (2) only left stochastic, (3) only right stochastic, or (4) neither left nor right stochastic but can be scaled to stochastic
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started