0% found this document useful (0 votes)
135 views2 pages

This Study Resource Was: Name: Section

This document provides instructions for creating matrices in MATLAB and performing operations on them. It defines three matrices, A, B, and C, and has the student write the MATLAB syntax to create them. It then has the student use MATLAB commands to calculate the product of A and C, the sum of A and the transpose of C, and other operations, recording the syntax used and the output.

Uploaded by

Angelo Santos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
135 views2 pages

This Study Resource Was: Name: Section

This document provides instructions for creating matrices in MATLAB and performing operations on them. It defines three matrices, A, B, and C, and has the student write the MATLAB syntax to create them. It then has the student use MATLAB commands to calculate the product of A and C, the sum of A and the transpose of C, and other operations, recording the syntax used and the output.

Uploaded by

Angelo Santos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

NAME : Section:

MATLAB ACTIVITY 2 – Matrix in MATLAB

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

Matrix MATLAB Syntax

Matrix2 = [pi*ones(1,5); ones(1,5); zeros(1,5);


ones(1,5)]

m
er as
co
eH w
o.
Matrix3 = [sqrt(2)*ones(3)]
rs e
ou urc
o
aC s
vi y re

B. In MATLAB enter the following matrices use appropriate format. Write your syntax in the space provided.
ed d
ar stu
is

MATLAB Syntax
Th

Syntax for the format : format rat


sh

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

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

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

This study source was downloaded by 100000834077335 from CourseHero.com on 10-21-2021 03:42:44 GMT -05:00

https://www.coursehero.com/file/76568166/MATLAB-ACTIVITY-2doc/
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

MATLAB SYNTAX: A*C

 9/ 2 9/4 15 / 4 
 19 / 12 3 / 2 
MATLAB OUTPUT:  11 / 12
 29 / 30 7 / 12 19 / 20

2. Sum of A and transpose of C

MATLAB SYNTAX:A+C’
 5 3/ 2 
 9 / 4 
MATLAB OUTPUT:  19 / 12
 49 / 20 19 / 6

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

co
eH w
MATLAB SYNTAX: 6*A’-2*C*B’

o.
rs e
MATLAB OUTPUT: Error using *. Incorrect dimensions for matrix multiplication. Check that the
ou urc
number of columns in the first matrix matches the number of rows in the
second matrix. To perform element wise multiplication. Use ‘.*’.
o

4. Sum of the product of A and its transpose and the product of C and its transpose.
aC s

MATLAB SYNTAX: (A*A’)+(C*C’)


vi y re

MATLAB OUTPUT:Matrix dimensions must agree.


ed d

5. Product of A and B
ar stu

MATLAB SYNTAX: A*B

MATLAB OUTPUT: Error using *. Incorrect dimensions for matrix multiplication. Check that the
is

number of columns in the first matrix matches the number of rows in the
Th

second matrix. To perform element wise multiplication. Use ‘.*’.


sh

This study source was downloaded by 100000834077335 from CourseHero.com on 10-21-2021 03:42:44 GMT -05:00

https://www.coursehero.com/file/76568166/MATLAB-ACTIVITY-2doc/
Powered by TCPDF (www.tcpdf.org)

You might also like