Answered step by step
Verified Expert Solution
Question
1 Approved Answer
need help with part a also need to find out how to define the function in terms of x(i) in matlab 2) In class, we
need help with part a
also need to find out how to define the function in terms of x(i) in matlab
2) In class, we derived the following matrix equation that must be solved to generate cubic spline interpolation 01 D2 D3 21 ZT-1 Un-2 hn-2 un-1 hn-1 (Here the blank entries in the matrix indicate these entries are equal to 0.) a) To form the natural cubic spline, we set zo0 and zn0 in (1), obtaining U1 12 U3 21 h ha Un-1 h-2 Un-1 2n-1 Write Matlab code to solve (2) (using your tridfun.m function), thus deter- mining the spline pieces S(z), and thus the entire spline S() Your code should then prompt the user for a number p and return the value S(p). Ifp is out of range, your program should say so. Finally, produce a Matlab plot of the graph of S(x). Have the spline itself as a solid green curve with the data points as magenta circles b) Another variant of the cubic spline is the "clamped" cubic spline in which we assign values to the derivative S'(z) at the endpoints to and tn. Modify (1) to include these two conditions while maintaining the tridiagonal structure, if possible. Your "answer" should be a matrix equation similar to (2). This is a "paper and pencil" exercise; I am not asking you to write code. 2) In class, we derived the following matrix equation that must be solved to generate cubic spline interpolation 01 D2 D3 21 ZT-1 Un-2 hn-2 un-1 hn-1 (Here the blank entries in the matrix indicate these entries are equal to 0.) a) To form the natural cubic spline, we set zo0 and zn0 in (1), obtaining U1 12 U3 21 h ha Un-1 h-2 Un-1 2n-1 Write Matlab code to solve (2) (using your tridfun.m function), thus deter- mining the spline pieces S(z), and thus the entire spline S() Your code should then prompt the user for a number p and return the value S(p). Ifp is out of range, your program should say so. Finally, produce a Matlab plot of the graph of S(x). Have the spline itself as a solid green curve with the data points as magenta circles b) Another variant of the cubic spline is the "clamped" cubic spline in which we assign values to the derivative S'(z) at the endpoints to and tn. Modify (1) to include these two conditions while maintaining the tridiagonal structure, if possible. Your "answer" should be a matrix equation similar to (2). This is a "paper and pencil" exercise; I am not asking you to write codeStep 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