Uploaded by rheabhansali5.0

Assignment3

advertisement
Introduction to Matlab/Octave
Assignment 3
Due October 27, 2021
What to turn in: Submit a copy of all your Matlab scripts. If a question asks
you to plot or display something to the screen, also include the plot and screen
output which is generated by your code. Submit a single file or archive named
Yourname.zip by email to georg.bader@b-tu.de.
1. The LORAN (LOng RAnge Navigation) system calculates the position of a
boat requires the solution of the following nonlinear system of equations:
y2
x2
−
= 1,
1862 3002 − 1862
(x − 300)2
(y − 500)2
−
= 1.
2792
5002 − 2792
a) Put the LORAN equations into the form of a homogeneous vector
function f (x).
b) Construct the matrix of partial derivatives Df (x).
c) Adapt the mymultnewton program (given in the lecture notes) to find
a solution for these equations. By trying different starting vectors, find
at least three different solutions. (There are actually four solutions.)
Think of at least one way that the navigational system could determine
which solution is correct.
2. Write function program x = Newton_sys(F,DF,x0,n) which implements
Newton’s method for systems of equations. F and DF should be the name of
a function programs for the implementation of the vector function and the
Jacobian matrix. x0 denotes a vector for the initial gues and n denotes the
requested number of iterations.
3. (a) Find the eigenvalues and eigenvectors of the following matrix by hand:
2 1
A=
.
1 2
(b) Find the eigenvalues and eigenvectors of the following matrix by hand:
1 −2
B=
.
2
1
Assignment 3
Introduction to Matlab/Octave
Can you guess the eigenvalues of the matrix
a −b
C=
?
b
a
4. For each of the following matrices, perform two iterations of the power
method by hand starting with a vector of all ones. State the resulting
approximations of the eigenvalue and eigenvector.
1 2
A =
3 4


−2
1
0
1 
B =  1 −2
0
1 −3
5.
a) Write a well-commented Matlab function program mypm that inputs
a matrix and a tolerance, applies the power method until the residual
is less than the tolerance, and outputs the estimated eigenvalue and
eigenvector, the number of steps and the scalar residual.
b) Test your program on the matrices A and B in the previous exercise.
6. You are given the following data:
t = [ 0 .1 .499 .5 .6 1.0 1.4 1.5 1.899 1.9 2.0 ]
y = [ 0 .06 .17 .19 .21 .26 .29 .29 .30 .31 .31 ]
a) Plot the data, using o at the data points, then try a polynomial fit of
the correct degree to interpolate this number of data points: What do
you observe. Give an explanation of this error, in particular why is the
term badly conditioned used?
b) Plot the data along with a spline interpolant. How does this compare
with the plot above? What is a way to make the plot better?
Download