Assignment 5 Solution
.pdf
keyboard_arrow_up
School
University of the Fraser Valley *
*We aren’t endorsed by this school
Course
135
Subject
Mathematics
Date
Jan 9, 2024
Type
Pages
5
Uploaded by CaptainEagle3867
MECE 390 Assignment 5
Instructions Answer the following questions and prepare a single PDF file including: -
Solution for Question 1 - Part I -
The MATLAB program for Question 1 - Part II -
MATLAB's output of the intermediate estimations for test 1 in Question 1 - Part II -
MATLAB's output of the intermediate estimations for test 2 in Question 1 - Part II -
Comments on Question 1 - Part III -
MATLAB's output of the intermediate estimations for Question 2 - Part I -
Discussion for Question 2 - Part II -
Example (Not to be added to your report): Note the following equations and information in this example will teach you to use the plotFunc3d only - these are not the equations you will be solving for! Consider the following equations: (1) −
?
−
?
+
?
+1= 0 (2) −
?
2
+
?
2
+
?
= 0 (3) −
?
2
−
?
2
−
?
2
+4= 0 These equations respectively describe (1) a plane, (2) a hyperbolic paraboloid, i.e. a saddle function, and (3) a sphere. We are interested in finding the two
points, in (
?
, ?
, ?
) coordinates, where these three surface plots all intersect. Figure 1
: 3D plot of the plane (Eq. 1), the paraboloid (Eq. 2), and the sphere (Eq. 3) intersecting each other.
You can use plotFun3d (available on eClass) to graphically estimate the position of the two real roots. Roots of the system correspond to common intersections of the three surfaces. In order to use plotFun3d
, make ?
coordinate the subject of your equations and then use the function handle to insert them as function arguments. A sample script called sampleFunc is provided on eClass to demonstrate how plotFun3d
should be executed. Question 1 Consider the following three equations: (1) 𝑓
1(
?
, ?
, ?
) = −
?
−
?
+
?
+1 = 0 (2) 𝑓
2(
?
, ?
, ?
) = −
?
2
+
?
+
?
2 = 0
(3) 𝑓
3(
?
, ?
, ?
) = ?
2
+
?
2
+
?
2
−4 =
0 These are the three equations you will use for your answers below. Question 1 –
Part I Determine the Jacobian Matrix 𝐽
for the system of Equations (1) to (3). NOTE: -
Report your answer as fractions and use the symbols "x", "y" and "z". -
For elements of the Jacobian matrix 𝐽
, evaluate the derivatives with respect to ?
, ?
and ?
respectively, e.g. 𝐽
11
=∂
𝑓
1
/
∂
?
and 𝐽
23
=∂
𝑓
2
/
∂
?
.
[
1
−1
−1
2?
1
−2?
2?
2?
2?
]
Question 1 –
Part II Write a MATLAB program to implement the Newton-Raphson Method. You can use the mldivide
, backslash operator or your Gaussian Elimination function (Lab 4) to solve the linearized system to obtain Δ
?
. You can compare your results (both the roots and the number of iterations) with the built-in MATLAB function fsolve ()
by using the command [x,fval,exitflag,output] = fsolve(@FUN, X0).
NOTE: Attach MATLAB program to PDF report. Test 1: -
An initial guess is given below. -
Run your program with this guess and document your results below. -
Report your answers to 5 significant digits e.g. ?
= 1.8141, 0.052189 or 1.5962*10
-5
-
Use the Euclidean Norm of the change in x ||
?
|| with Tolerance 10
−5
to test convergence. Iteration x y z ?
𝑟
0 0.70382 0.43435 0.86946 1 1 1.3714 0.70562 1.6658 0.47307 Number of iterations used to achieve convergence: 5 or 6 (starting from 0 or 1) NOTE: Attach the MATLAB output of the intermediate estimations! x y z Root: 1.173 0.7239 1.4491 Test 2: -
Try different initial guesses with your MATLAB program until you find the other root and then answer the following questions. -
Report your answers to 5 significant digits e.g. ?
= 1.8141, 0.052189 or 1.5962*10
-5
-
Use the Euclidean Norm of the change in x ||
?
|| with Tolerance 10
−5
to test convergence. NOTE: Attach the MATLAB output of the intermediate estimations: x y z Root: -1.3716 -1.1981 0.8265 Question 1 –
Part III Try the following three initial guesses in your MATLAB program, answer the following questions, and comment on your tests.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help