Professional Documents
Culture Documents
Review Problems: Week #1 Problem #1 1) Consider The Vector X (-4, - 2, 0, 2, 4, 6, 8, 10, 12)
Review Problems: Week #1 Problem #1 1) Consider The Vector X (-4, - 2, 0, 2, 4, 6, 8, 10, 12)
Problem #1
(a) Use the colon notation to generate a variable m that is identical to the variable x.
(b) Use the function linspace to generate a variable p that is identical to the variable x.
(c) Use the colon notation to generate a variable s that is identical to the variable y.
(d) Use the function linspace to generate a variable t that is identical to the variable y.
Problem #2
Assume that the variables A and B, shown below, have already been generated in MATLAB.
2 −1 3 5
0 0 1 7
15 12 20 30
A = 9 2 6 3 𝐵 = [ ]
50 70 90 80
4 −7 −5 −2
1 0 3 6
1. Write one single MATLAB statement that generates the variable C, shown below, using the existing
variable A.
2 3
0 1
𝐶= 9 6
4 −5
[1 3 ]
2. Write one single MATLAB statement that generates the variable M, shown below using the variables A
and B.
15 12 20 30
50 70 90 80
𝑀=[ ]
2 −1 3 5
0 0 1 7
G = B; G(4,5) = 10;
What is G equal to after the above statements have been executed in MATLAB?
Problem #3
Assume the following variables have already been generated in MATLAB,
x = [4 8 5];
y = [3 1 2];
Specify the contents of the variables C1 through C4 generated by the following statements:
1. C1 = 1 + x.*y.^2;
2. C2 = y + 1./y;
3. C3 = x./y;
4. C4 = (x + y).*y;
Problem #4
1. Generates a linearly equally spaced vector t containing 20 elements, with a start value equal to 0 and an
end value equal to 8.
8 + cos 2 (3𝑡) 𝑒 −𝑡
𝑓(𝑡) = 1 +
1 + 𝑡3