Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Looking for the actual MATLAB code . thank you! Loose Leaf for Numerical Methods for Engineers (7th Edition) Chapter 18, Problem 23P Problem: Develop, debug,
Looking for the actual MATLAB code. thank you!
Loose Leaf for Numerical Methods for Engineers (7th Edition)
Chapter 18, Problem 23P
Problem: Develop, debug, and test a program in either a high-level language or macro language of your choice to implement cubic spline interpolation based on Fig. 18.18. Test the program by duplicating Example 18.10.
Fig. 18.18 shown below:
Example 18.10. shown below:
18.7 MULTIDIMENSIONAL INTERPOLATION 521 SUBROUTINE Interpo1 (x,y,n, d2x, xu,yu,dy,d2y) flag = 0 SUBROUTINE Spline (x.y,n,xu.yu,dy,d2y) LOCAL en, fr, 9n, rn. d2x CALL Tridiagtx,y.n,e,f.g.r) CALL Decomp(e,f.g.n-1) CALL Subst(e,f.g,r,n-1,d2x) CALL Interpol (x,y,n,d2x,xu.yu,dy, d2y) END Spline IF xu X1-1 AND xu x, THEN SUBROUTINE Tridiag (x,y,n,e,f.g,r) t1 = c1 * (x1-xu? g-(x-X) t4-c4(xu - x-) yu-t + t2 t3+t4 OFOR e, = 2, n-2 (x-X-1) g, = (x1+1 x1) t3--c3 - dy-t1 + t2 t3t4 END DO t2- 6c2 (xu - x-1 d2y-t1+t2 flag - 1 -2*(xn-X-2) ELSE END Tridiag END IF IF i-n+1 OR flag-1 EXIT END DO IF flag 0 THEN PRINT "outside range pause END IF END Interpol FIGURE 18.18 Algorithm for cubic spline interpolation 18.7 MULTIDIMENSIONAL INTERPOLATION 521 SUBROUTINE Interpo1 (x,y,n, d2x, xu,yu,dy,d2y) flag = 0 SUBROUTINE Spline (x.y,n,xu.yu,dy,d2y) LOCAL en, fr, 9n, rn. d2x CALL Tridiagtx,y.n,e,f.g.r) CALL Decomp(e,f.g.n-1) CALL Subst(e,f.g,r,n-1,d2x) CALL Interpol (x,y,n,d2x,xu.yu,dy, d2y) END Spline IF xu X1-1 AND xu x, THEN SUBROUTINE Tridiag (x,y,n,e,f.g,r) t1 = c1 * (x1-xu? g-(x-X) t4-c4(xu - x-) yu-t + t2 t3+t4 OFOR e, = 2, n-2 (x-X-1) g, = (x1+1 x1) t3--c3 - dy-t1 + t2 t3t4 END DO t2- 6c2 (xu - x-1 d2y-t1+t2 flag - 1 -2*(xn-X-2) ELSE END Tridiag END IF IF i-n+1 OR flag-1 EXIT END DO IF flag 0 THEN PRINT "outside range pause END IF END Interpol FIGURE 18.18 Algorithm for cubic spline interpolationStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started