matlab hw

amoory747
MATLABHw.docx

The following exercise is mostly based on the MATLAB Basics material provided. Students are expected to use MATLAB online help as necessary.

1. Plot the sin(θ) and cos(θ) functions for the angle in the domain θ = [0, 10π] in:

a. Single plots (Make sure to include X and Y axes labels, function legends, and title for each plot). (You need to use ‘figure()’ command in your script in order to show them in different figures)

b. Two separate plots in a single window. (Use ‘subplot’ function and show the X and Y labels, legends, and title.)

c. Repeat (a) & (b) with θ in degrees (not radians). (look up ‘sind’ or ‘cosd’ function)

2. Consider the following equations

2𝑥 − 3𝑦 + 4𝑧 = 23

−6𝑥 − 7𝑦 + 8𝑧 = 3

5𝑥 − 𝑦 − 2𝑧 = 5

Solve for the unknowns x, y and z.

3. Consider the following equations, where A, B and C are constants

(9𝐴2 + 20𝐶2)

9𝐴𝑥 − 6𝐴𝑦 + 4𝐶𝑧 + = 0

𝐴𝐵𝐶

21

6𝑥 − 4𝑦 − 𝑧 − = 0

𝐴𝐵

63

24𝑥 + 5𝑦 − 4𝑧 − = 0

𝐴𝐶

Solve for the unknowns x, y and z. (Use ‘syms’ command)

4. Solve the following equation for the unknown ‘t’. (Use ‘solve’ command)

3𝑥2 = 3𝑒6𝑡

5. Consider the following matrices

1 2 3 1 −5 3

1 2 3

𝐴 = [4 5 6] , 𝐵 = [6 5 4] 𝐶 = [ ]

4 5 6

7 8 9 3 2 1

a. Find the following

i. Addition, subtraction, division and multiplication of the two matrices A and B without using the dot operator. Confirm the results by doing the same calculations by hand (10 points)

ii. Addition, subtraction, division and multiplication of the two matrices A and B using the dot operator. Is there an error in any of the above operations? Which operations are those, and why would the errors occur in your opinion? Again do hand calculations to get the same result.

b. Check which of the following is possible and explain why that is the case,

i) 𝐴 × 𝐶 & 𝐵 × 𝐶

ii) 𝐶 × 𝐴 & 𝐶 × 𝐵