Matlab Activity 2

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

MATLAB ACTIVITY 2 – Matrix in MATLAB

A. Write the syntax that will create the following matrices.

Matrix MATLAB Syntax

A=[1,1,1,0,0;1,1,1,0,0;1,0,0,1,0;0,1,0,1,0;0,0,1,1,0]

A=[sym(pi)*ones(1,5);1,1,1,1,1;0,0,0,0,0;1,1,1,1,1]

A=[sqrt(2),sqrt(2),sqrt(2);sqrt(2),sqrt(2),sqrt(2);sqrt(2),sqrt(2),sqrt(2)]

B.   In MATLAB enter the following matrices use appropriate format. Write your syntax in the space provided.

MATLAB Syntax

Syntax for the format : >>format rat

Syntax for Matrix A: >>A=[1,1/2;1/3,1/4;1/5,1/6]

Syntax for Matrix B : >> B=[5,-2]

Syntax for Matrix C : >>C=[4,5/4,9/4;1,2,3]

Using MATLAB commands and the Matrices in above compute the following expressions if possible.
Write the MATLAB SYNTAX you used and MATLAB out put on the space provided

1. Product of A and C
>>[A*C]

2. Sum of A and transpose of C

>>[A+C’]

3. Six times of transpose of A subtracted to Twice C multiplied to transpose of B

>>[((A'*6)-(2*C))*B']

4. Sum of the product of A and its transpose and the product of C and its transpose.
>>[(A*A')+(C*C')]

5. Product of A and B

>>[A*B]

Honor Pledge:
“I affirm that I have not given or received any unauthorized
help on this assignment, and that this work is my own.”
SCREENSHOTS:

You might also like