The following MATLAB commands/functions, which generate special matrices, are often used in engineering computations involving matrices:

`zeros(p, q)`It returns a rectangular p × q matrix of all zeros.

Let p = 2 and q = 3, and execute the following commands.

p=2; q=3; A=zeros(p, q)

This will generate a (2 × 3) matrix with all elements equal to zero. The following result will be shown

A = 0 0 0 0 0 0

`ones(p, q)`It returns a p × q matrix of all ones.

Let p = 2, q = 3, and execute the following commands.

p=2; q=3; A=ones(p, q)

It will generate a (2 × 3) matrix with all elements equal to one. The following result will be shown:

A = 1 1 1 1 1 1

`eye(p, q)`It returns a p × q matrix with ones on the main diagonal and zeros ...

Start Free Trial

No credit card required