0% found this document useful (0 votes)
44 views

Week 8 Monday 12-1 Class

This document contains the instructions for an assignment that is due during a Monday class. It includes 5 math problems to solve involving vector algebra, products, linear systems of equations, polar curves, and finding the sum of the roots of a polynomial equation. The student is instructed to save their work in MATLAB m-files labeled a1.m through a5.m and are given 40 minutes to complete the assignment.

Uploaded by

Patricia
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)
44 views

Week 8 Monday 12-1 Class

This document contains the instructions for an assignment that is due during a Monday class. It includes 5 math problems to solve involving vector algebra, products, linear systems of equations, polar curves, and finding the sum of the roots of a polynomial equation. The student is instructed to save their work in MATLAB m-files labeled a1.m through a5.m and are given 40 minutes to complete the assignment.

Uploaded by

Patricia
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

Week 8

Monday 12-1 Class

Instructions: Save your answers in m-les titled a1.m, a2.m, a3.m, a4.m and a5.m respectively.
Time allowed: 40 minutes.
1. (4 marks)
Enter the following three row vectors a, b and c, and evaluate the vector algebra expressions
u = 2b - 5c and v = -3a - c if they exist:


c = [3, 1, 1, . . . , 17]
a = [1, 2, 3, . . . , 11],
b = [ 2, 4, 6, . . . , 20],
2. (3 marks)
42

tanh(n)
Evaluate the product:
n sin(n)
n=27

3. (4 marks)
Dene the coecient matrix A and the right-hand-side vector b for the linear system
x1
10x1
4x1

10x2
2x2

x2

8x3
4x3
2x3
2x3

4x4
4x4
3x4
6x4

=
=
=
=

10,
2,
2,
3.

Set up the augmented matrix [A | b] in the variable Ab, calculate the reduced row-echelon
form R and display the appropriate message: Linear system has no solutions, Linear
system has a unique solution or Linear system has infinitely may solutions.
(Decide which case is appropriate just by looking at R. You are not asked to nd a solution.)
4. (4 marks)
Create a plot of the polar curve r = 3 4 cos2 (3) for 0 2.
Give the plot a title, and save the plot in a PostScript le called aplot.ps (using print).
5. (5 marks)
The curves y = x4 and y = 4x3 + 11x2 29x intersect at four x-values: x1 , x2 , x3 and x4 .
Calculate x1 + x2 + x3 + x4 .

Week 8

Monday 12-1 Class

1. format compact
a = [1:11]
b = [2:2:20].^0.5
c = [3:-2:-17]
%check if vector addition is defined
length(b) == length(c)
%b and c have different lengths, so u does not exist
disp(b and c have different dimensions, so u does not exist)
length(a) == length(c)
%a and c have the same length, so v exists
v = -3*a - c
2. n = [27:42];
prod(tanh(n)./(n.*sin(n)))
3. format compact
A = [1 10 8 4;
-10 -2 -4 -4;
-4 0 2 3;
0 -1 -2 -6]
b = [10 -2 2 3]
Ab = [A b]
R = rref(Ab)
%only columns 1-4 are leading, so the system has a unique solution
disp(Linear system has a unique solution)
4. theta = linspace(0, 2*pi);
r = 3 - 4*(cos(3*theta)).^2;
polar(theta, r)
title(Graph of r = 3 - 4cos^2(3\theta) for \theta \in [0, 2\pi])
print -dps aplot
N.B. If you copy this solution into MATLAB, the slashes dont copy properly.
5. format compact
%define the difference function f
%note that solving f(x) = g(x) is the same as solving f(x) - g(x) = 0
f = inline(x.^4 - 4.*x.^3 - 11.*x.^2 + 29.*x)
ezplot(f, [-30 30]), figure(1), grid on
%roots of f occur for some values of x between -10 and 15, so zoom in:
ezplot(f, [-10 15]), figure(1), grid on
%roots of f occur for some values of x between -5 and 6, so zoom in again:
ezplot(f, [-5 6]), figure(1), grid on
%we observe that roots occur close to -3, 0, 2 and 5
x1 = fzero(f, [-4 -2]), x2 = fzero(f, [-1 1])
x3 = fzero(f, [1 3]), x4 = fzero(f, [4 6])
x1 + x2 + x3 + x4
%refer to the MATLAB notes for instructions on using the fzero function
%www.asoc.unsw.edu.au

You might also like