Math1151 Matlab Lab Test Practice
Math1151 Matlab Lab Test Practice
create arrays
colon operator
element by element multiplication
element by element division
element by element power
sum
product
maximum
minimum
reduced row echelon form
matrix left-division operator
display a text message
change the format of screen output
relative machine precision
create an anonymous function
finds zero(s) of a function
finds a local minimum of a function
plots data points
put gridlines on a plot
annotations for a plot
polar plot
linearly spaced points
MATLABs online help function
save plot as postscript file
For the test, you also need to understand how to create and modify M-files using the MATLAB
editor. A brief guide explaining how to do this when for the questions during the test will be
available on UNSW Moodle.
The harder exercises are marked with an asterisk. Each test will contain four routine
questions and one harder one.
Exercises
1. Enter the following three vectors a, b and c, and evaluate the vector algebra expressions
2a + 13b and 12a 4c, if they exist:
a = [1, 2, 3, 4, . . . , 11] ,
b = [1, 3, 5, 7, . . . , 21] ,
1
1
1
1
= 1 + + + +
.
n n
2 2 3 3
100 100
.
(2n 1)(2n + 1)
(1)(3) (3)(5) (5)(7)
(199)(201)
n=1
4. Find the largest number in the infinite sequence a1 , a2 , a3 , . . . if
an =
n5
.
2n
5. Define the coefficient matrix A and the right-hand-side vector b for the linear system
4x1
3x1
18x1
x2 + 3x3
+ 3x2
+ 2x3
+ 3x2 + 5x3
+
+
+
+
2x4
4x4
3x4
8x4
= 3,
= 4,
= 2,
= 3.
Set up the augmented matrix [A | b], calculate the reduced row-echelon form R and
display the appropriate message: Linear systems has no solutions, Linear system
has a unique solution, Linear system has infinitely many solutions. (Decide
which case is appropriate just by looking at R. You are not asked to find a solution.)
6. Solve the linear system
3x1
4x2
x1
x1
2x2
+ x2
x3 + 2x4 + x5
+ 2x3
x5
+ 2x3 + x4
x3 + 4x4
+ 7x5
= 8,
= 15,
= 4,
= 1,
= 32.
x = sin 2t +
t2
y = t
3
for
t ,
2
put gridlines on the plot and then save the plot in a PostScript file myplot.ps (using
print).
2
x2
sin 8x
,
3
has a global minimum at a unique point xmin and a global maximum at a unique point xmax .
Find xmin and xmax , correct to at least 5 significant figures.
SAMPLE VERSION
Time allowed: 45 minutes.
Use semi-colons where appropriate.
1. Enter the following three vectors a, b and c, and evaluate the vector algebra expressions
2a 3b and 7a 4c, if they exist:
a = [1, 2, 3, 4, . . . , 11] ,
3. Define the coefficient matrix A and the right-hand-side vector b for the linear system
6x1 + 4x2 x3 + x4
x1 2x2
+ x5
2x1 + 2x2 + 9x3 + 2x4
3x2
4x5
x1
2x3 2x4 + 5x5
= 5
= 3
= 8
= 11
= 3.
Set up the augmented matrix [A | b], calculate the reduced row-echelon form R and
display the appropriate message: Linear systems has no solutions, Linear system
has a unique solution, Linear system has infinitely many solutions. (Decide
which case is appropriate just by looking at R. You are not asked to find a solution.)
4. Create a plot of the polynomial x5 9x3 + 2x 4 for 3 x 3 put gridlines on your
plot and then save the plot in a PostScript file myplot.ps (using print).
5. * Find the unique point of R2 where the two curves
y = x3 5x 1 and y = 5 ex
intersect. The coordinates should be correct to machine precision.