Question: MATLAB: Defining Matrices % In this activity you will learn how to define matrices, use the size ( ) command to find the size %

MATLAB: Defining Matrices
%In this activity you will learn how to define matrices, use the size() command to find the size
%of a matrix, generate an identity matrix, and also compute the transpose of a matrix using
% the ".'" operator.
%Matrices in Matlab can be constructed by entering each row of values.
%Rows are separated from each other using a semicolon.
%For example, consider the 24 matrix B defined as:
%The size() function can be used to compute the number of rows and columns of a matrix.
%compute the number of rows and columns of B by using the size() function and store these values.
[numRowsTest, numcolsTest]=size(B)
%The eye() function can be used to create an n by n identity matrix.
% create the 33 identity matrix and store it as I.
I=eye(3)
%The "dot-tic" operator can be used to transpose a matrix.
%Take the transpose of the matrix B and store it as the matrix C.
C=B*'
Script 8
%Define the 33 matrix A with all 1's in the first row, all 2's in the second row,
%and all 3's in the 3rd row.
% Use the size() function to compute the number of rows and columns of matrix A.
% store these quantities as variables numRows and numcols.
%use the eye() function to create the 44 identity matrix. Store this matrix as I.
%Compute the transpose of the matrix A. Store this transposed matrix as the matrix D.
Assessment:
Matrix A is correct
numRows variable value is correct
numCols variable value is correct
Identity matrix is correct
Matrix D is correct
 MATLAB: Defining Matrices %In this activity you will learn how to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!