{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hw7_sol - 15.2 The points can be ordered so that they are...

This preview shows pages 1–12. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 15.2 The points can be ordered so that they are close to and centered around the lull-(noun. A divided-difference table can then be developed as x for} First Second Third Fourth 3 5.25 T25 2 [1.25 {I 5 1925 5.25 2.?5 0.25 2 4 B 1.?5 6 35 6.25 ‘l 4.?5 Note that the fact that the founh divided difference is. zero means that the data was. generated with a third-order polynomial. First order: I; [—1) = 5.25 + T.25(4— 5) =12.5 fzt4j=115 + [:4 — 5)(4 — 5E =1D.5 Third older: f3 (4) = “3.5 + [4—3)(4 — 5}(4— 30.25 =10 Fourth order: f3(4}=10.5 + (—1— 3)[—1— 5)(4 — 2}(4 — 6}D=1{) 15.3 Lagrange polynomial. First order: 4—5 4—3 4 =—5.25+ 19.?5=12.5 fl( ) 3—5 5—3 Second order: f3 {4:}:ng35 +W19I75 +W4=105 ' T3 - 5X3 — 3) (5 - 3H5 — 3) (- - 3X2 - 5) Third order: = [4—5}(4—2)[4—6} 525+ (4—3}(4—2}(4—6}19ITS (3—5)t3—2)<3—6)' (S—BHS—EDCS—ﬁ) ' . (Lam—53mm“ (4-3)(4-5}(4-2} (2—3)t2—5)(-—6) (mars—5x64) 15.5 MATLAB can be used To generate a cubic polynomial Through The ﬁrst 4 points in the Table. f3 (4} 36:10 3*} X = [l 2 3 ‘9]; 3*} fx = [3.6 1.8 1.2 0.9]; 3*} p = polyfitllxr fx,3} p : -U.15C'U 1.5000 —5.25C'0 7.5000 Therefore. The roots problem to be solved is 1.6 =—a.15x3+1.5x3—5.25x + as 01‘ f(.r} = —a.15x3+1.5x3—5.25x + 5.9 = a Biseetion can be employed the root of This polynomial. Using initial guesses ofx: = .. and In = 3. a value of 2.2156 is obtained with £3 = 0.0006991} after 16 iterations. 15.7 (:1) Because they bracket the tuilqtown. the two last points are used for linear interpolation. .? — .5 5 flail18)=5.5453+M(0.113—a11144)=5.643t 0.1254T—0.lll44 (b) The quadratic interpolation can be implemented easily in MATLAB. >> v = [0.103?7 0.1144 0.1254T]; >> s = [6.414? 6.5453 6.166%]; 5) p = polyfit{v,s,2} p: 354.2358 —Eé.99?6 9.3450 ?} polyvalip,0.ll\$) ans = 6.601? Therefore. to the level of signiﬁcance reported in the table the estimated entropy is 6.6077 (c) The inverse interpolation can be implemented in MATLAB. First. as in part u—‘e can ﬁt a quadratic polynomial to the data to yield. P [-0 H [H 4.2353 -6é.99?€ 9.3450 “We must therefore find the root of 6.45 = 354.2358):2 — 64.9976x + 9.3450 or 6.45 = 354.2358):2 — 54.99%] + 2.8950 In hiATLAB. we can generate this polynomial by subtracting 6.45 from the constant coefﬁcient of the polynomial >5 p(3)=p(3)—6.1’:5 [3 LL'I || til 4.2358 —Eé.99?6 2.- ro 'sD in CI Then. we can use the roots function to determine the solution. >> root5{p] ans = 0.1074 0.0761 Thus. the value of the specific volume corresponding to an entropy of 6.45 is 0.1074 15.10 Errata: In the first printing, the problem statement asked for a fifth—order interpolating polynomial which cannot be obtained with the 5 given points. Subsequent printings only ask for third—order and fourth-order polynomials. Third-order case: The MATLAB polyﬁt function can be used to generate the cubic polynomial and perform the interpolation. }} x = [1.8 2 2.2 2.4]; }} J = [0.5615 0.5?67 0 5560 0 520:], >> p = polyfit{x,J,3} p = 0.016? —0.2988 0 9306 —0.2229 }} Jpred=polyval(p,2.1} Jpred = 0.5683 The built-in function besselj can be employed to determine the true value which can then be used to determine the percent relative error >> Jtrue=besselj(1,2.1} Jtrue = 0.5683 }} ea=ab5i(Ctrue—Jpred}thrue]*100 a = 3.15T39—004 L'D Fourth-order case: >> x = [1.3 2 2.2 2 4 2.6], >> J = 0.5815 0.5?67 0.5560 0.520: 0.4?08]; }} p = polyfit{x,J,4} p = 0.0182 —0.1365 0.1818 0.2630 0.123? >> Jpred=polyval{p,2.1} Jpred = 0.5683 >> ea=abat(Ctrue—Jpred}thrue]*100 ea = 0.0021 16.1 (a) The simultaneous equations for the natural spline can be set up as 1 cl' 0 ' 1 3 0.5. 1:2 0 0.5 2 0.5 c3, _ —6 0.5 3 1 c4 _ —24 1 4 1 ('5 1s 1 es 0 These equations can be solved for the (3‘s and then Eqs. (16.21) and (16.13) can be used to solve for the [1's and the d‘s. The coefﬁcients for the intervals can be summarized as interval a b C d 1 1 3.9T9954 9 9.829948 2 5 4.858991 8.88713? 8.48884 3 T 3.849249 -8.52282 43.31535 4 8 —1.41989 -9.99585 5.414938 5 2 —5.‘|8598 8.248983 2.88299 These can be used to generate the following plot of the natural spline: DIN-B01030 Notice how the not-a-knot version exhibits much more curvature. partielﬂaﬂy between the laat points. [13) The piecewiae eubie Hermite polynomial and ita plot can be generated with MATLAB as 3>) X [l C 4 5]; 3;; y [l E 1]; >> xx = linspaceﬂl,5}: >> yy = interpl {erJXXr 'E'ChiF'JF >3: plc-t{x,y, 'C'TrxerY} -..J b.) m in l' 3 LL! 16.3 (a) The llﬂt-ﬂ-kllOT ﬁt can be r:.e’r up in MﬁJ'LAB as >? x = linspace{ﬂ,l,ll}; >> y = l.f{[x—O.3].“C+O.Ulj+l.f{[x—D.9).“C+U.04}—E; >> xx = linapaceiﬂ,l}; >§ yy 5p1ine{x,y,xx}: >> yh l.f[[xx—0.3).“Z+U.Dl}+1.fﬁ{xx—D.9}.A2+D.Oé]—E; >§ plct{x,y,'c*,xx,yg,xx,yh,T——'j 10D ED ED 40 20 D ﬂ.2 0.4- 0.6 (LEI 1 (b) The piecewise cubic Hermite polynomial ﬁt can be rget up in [VIATLAB as >> = linspace{ﬂ,l,ll}; >> — l.f{[x—O.3].“C+O.Ulj+l.f{[x—O.9).“C+U.Dé}—E; >§ XX = linspace(ﬂ,l}: >> yy = interpl{x,y,xx,'pchip']; >} yh = l.f[[xx—0.3).“:+U.Dl}+1.f[{xx—D.9}.*:+D.Dé]-E; >> plct{x,y,'GT,xx,yy,Xx,yh,T——'j H1 N | 16.5 (a) The llot-a-kno‘r ﬁt can be SET up in NIATLAB as D? x = [-1 -D.E -U.2 0.2 0.6 1]; >:»y=[000111]: >> xx = linspacei—l,l}: >) yy 2 spline§xryJXX}F >> 1::1C-‘t:{:>s‘..r y, 'c-T . xx; YE} 12 1 DE DE- 04- 31 -05 D D5 1 (b) The clamped spline with zero end alopea can be set up in MQLTLAB as >§ x = [—1 —D.E —U.2 0.2 0.6 1]; >> y = [O U D l l l]: >§ ya = [U y D]; }} xx = linspacei—l,l}: }} yy = 5pline{x,ys,xx}; >> E'lc-t {Kr Y: '6‘ .XX: FY} 12 11 —D5 U 05 1 {e} The piecewise eubie Hermite polynomial ﬁt can he get up in NIATLAB as 3} x = [—1 —D.6 —u.2 0-2 0.6 1]; 3} y = [e a D l 1 i]: §§ xx = linspacei-l:1}F }} yy = interpl{er;KKr'PChiF'}F >3 plct{xry:'GT:XX:YY} 16.10 (:1) Here is a MATLAB seaaion to develop The 5p1i11e and plot it along with The dam: >> x=[D C 4 T 1012]; >> y=[20 El] 12 “J 'E- E]; >3> xx=linspace{0,12): >> yy=splinetx,y,xxj; >3> ple-t{x,y, 'c-T,xx,yy}l 25 ‘15 1C! Here is the command to make the prediction: >> yp=splinetx,y,1.5} (b) To prescribe zero first derivatives at the end knots. the y vector is modiﬁed so that the first and last elements are set to the desired values of zero. The plot and the prediction both indicate that there is less overshoot between the first two points because of the prescribed zero slopes. )} yd=[0 y D]; }) yy=splinetx,yd,xx}; >3 plottmy; 'c-HXXIYY} >> yy=splinetx,yd,l.5} 20.5?01 ...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern