Matlab Question from A practical introduction to programming
Matlab Question from (A practical introduction to programming and problem solving. 4th edition. Attaway.) Question Ch 2-18
18. Create a variable rows that is a random integer in the inclusive range from 1 to 5. Create a variable cols that is a random integer in the inclusive range from 1 to 5. Create a matrix of all zeros with the dimensions given by the values of rows and cols.Solution
row= floor((5-1).*rand(1) + 1)
col= floor((5-1).*rand(1) + 1)
z = zeros(row,col)
rows variable stors size of matrix rows
and col vairable store size of matrix col
and z is a matrix of row*col
zeros(row,col) is a function with matrix with all zeros
