Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Its a matlab assignment and i need 1 page of matlab code and 1 page of report in pdf form.i need the expert to follow the instructions given in the assignment. thanks

1 answer below »
compAssign2
MACM 316 – Computing Assignment #2
Due Date: Friday October 9 at 11:00pm
Submission Instructions: You must upload one .pdf file to Crowdmark that consists of 2 pages
ONLY: page 1 is your report which should fit all of your results, discussion, data and figures into a single
page; and page 2 is a listing of your code. The deadline is 11:00pm on the due date. The actual due
time is set to 11:05pm – if Crowdmark indicates that you submitted late then you will be assigned a
grade of 0 on this assignment. Your TA has emailed you a Crowdmark link that you will use for the
entire semester to upload your assignment solutions.
• Review the Guidelines for Computing Assignments carefully.
• Acknowledge any collaborations or assistance from colleagues/TAs/instructor.
• If you have questions about this assignment or Matlab programming, you can obtain help by posting
your questions to the “Computing Assignment” discussion board in Canvas. This discussion board
will be checked regularly, and also monitored continuously during computational workshop hours.
Computing Assignment – Root-Finding in Geometric Design
Motivation: You have a part-time job stocking shelves at a local, family-owned lumber and building
supply store. In an e↵ort to replace lost sales revenue during the pandemic, the owner has discovered
a market for a value-added product: custom-sized, folding picnic tables to satisfy the huge demand
from local restaurants that have recently opened outdoor patios. Knowing that you are an SFU student
with expert training in calculus and scientific computing, she has come to you for help in a method fo
determining how to cut the lumber the co
ect size for each customer’s special needs.
Your boss presents you with the photograph in Figure 1, and a diagram showing the relevant dimensions
of the legs identified in Figure 2. The overall table dimensions are determined by the width w and height
Figure 1: Photograph of the picnic table design.
1
Monday, June 12 at 11 pm
Figure 2: Diagram of the leg assembly, defining the various geometric parameters.
h of the leg assembly, whereas the choice of leg material determines the leg thickness b. The parameters
h, w and b all known ahead of time because of customers’ aesthetic and practical considerations (i.e.,
they are given constants). The remaining measurements for a, c, d1 and d2 indicated in the diagram in
Figure 2 must be determined before the legs can be manufactured.
Problem set-up: Armed with the promise of a big bonus, you apply your solid grounding in trigonom-
etry to the leg geometry from Figure 2 and derive the following equations relating the various parameters
h = 2d2 sin ✓, w = 2d2 cos ✓ + b2 and b = b2 sin ✓, (1)
where ✓ represents the angle at which the legs meet the ground. Combining these equations to eliminate
d2 yields a single nonlinear equation for the unknown angle ✓†:
w sin ✓ = h cos ✓ + b. (2)
The procedure for determining the leg dimensions required in the manufacturing process can now be
described as follows. First, solve Eq. (2) for ✓. Then, the leg half-length d2 can be computed from the
first equation in (1). The other major leg measurement is d1 which can be found from
d1 = d2 � a� c,
where a and c are written in terms of tangents as
a =
tan↵
and c =
tan ✓
, with ↵ =

2
� ✓.

As a “check” for co
ectness, setting b = 0 (a zero-thickness leg) gives h/w = tan ✓ – as expected!
2
Report specifications: After discussions with your boss, you have come up with the following list of
equirements for a report that will earn you your bonus:
(a) Express Eq. (2) as a nonlinear root-finding problem of the form f(✓) = 0, whose solution is the leg
angle ✓. Implement the function in Matlab, by first defining variables co
esponding to these table
specifications: w = 28, h = 25 and b = 3.5, all measured in inches‡. Next, define f as a single-line
anonymous function
§
of the form
f = @(theta) ...
Plot your function f(✓) on the interval ✓ 2 [�⇡,⇡] and describe its overall behaviour, as well
as indicating the number of roots, and their approximate location. Your boss has one special
equest: she understands that mathematical calculations for angles require working in radians, but
her cutting machines are cali
ated in degrees. So she asks that all plots and numeric results be
eported in degrees instead.
(b) Apply three root-finding algorithms to determine the smallest positive root of f(✓) (call it ✓⇤) to
within an e
or tolerance of 1 degree

:
• Bisection method, for which you can use the bisect2.m code from lectures.
• Fixed-point method, using fixedpt.m. You will first have to derive a suitable fixed-point
iteration of the form ✓k+1 = g(✓k) that is equivalent to finding a root of f(✓).
• Newton’s method, using newton.m, which requires you to define a second function that com-
putes the derivative f 0(✓). Luckily, you remember the oft-overlooked calculus fact that the
usual di↵erentiation formulas for trig functions only hold when the angle is measured in ra-
dians. So you need to be sure that your code performs all calculations in radians and does a
conversion to degrees for output/plotting purposes.
Use a very rough initial guess ✓0 = 0 (or
acket [✓0, ✓1] =

0, ⇡2

) for each method based on you
plot from part (a). Compare the cost of the three methods for approximating ✓⇤ in terms of the
number of iterations required, and explain any di↵erences you observe.
(c) Although it’s not obvious, an exact solution can be found for Eq. (2):
cos ✓⇤ =
1
(h2 + w2)

�bh+
p
2h2 + (h2 + w2)(w2 � b2)

(3)
Implement this formula for the exact root ✓⇤ in your code (with Matlab’s inverse cosine function,
acos) and use it to compare the accuracy of your three approximations from part (b). Explain.
Note: I only want you to use Eq. (3) here, not derive it. But if you’re curious to see where it
comes from, try squaring both sides of Eq. (2) and applying the identity sin2 ✓ = 1� cos2 ✓.
(d) Using your most accurate approximation from part (b), determine the co
esponding estimates of
the design parameters d1 and d2. Because customers paying top dollar for these tables demand
high quality and workmanship, your boss’s final requirement is that both of leg measurements d1
and d2 must be accurate to within a tolerance of 0.1 inches. Is your solution accurate enough?
Finis! Your bonus and a possible promotion to Assistant Manager await!

Why aren’t we using metric? Well, lumber is still sold inches and feet, and b = 3.5 inches is the actual dimension of a
finished “2-by-4” board that’s commonly used to build picnic tables.
§
For help on anonymous functions see either the lecture notes, my Whirlwind Tour, or type “doc anonymous”.

Hint: Be very careful here. Your angle ✓ should be measured in degrees, but all trig functions in Matlab expect an
argument that’s measured in radians.
3
Answered 1 days After Jun 06, 2023

Solution

Baljit answered on Jun 08 2023
26 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here