Question
Let f(x) = cos(2x) 3x 2 + 4x (i) For X = [1 1.2 2.3 2.5 3.1 3.7 4] Generate table of abscissas and ordinates
Let f(x) = cos(2x) 3x
2 + 4x
(i) For X = [1 1.2 2.3 2.5 3.1 3.7 4] Generate table of abscissas and ordinates using above function.
(ii) Now write a MATLAB code by following below steps. Step 1: Enter data formed in part (i) in variable X and Y Step 2: Apply Lagrange interpolation to the above data. Your code should also predict the value at x = 3. The outputs on screen should be (i) Lagrange polynomial in formatted form like ax^6 + bx^5 + cx^4 + dx^3 + ex^2 + fx^1 + gx^0 where a,b,c,d,e,f,g are constants. (ii) The predicted value at x = 3 using Lagrange polynomial. Step 3: Fit the data formed in part (i) to a parabolic curve using method of least squares. The outputs on screen should be the Parabolic polynomial in formatted form like ax^2 + bx^1 + cx^0 where a,b,c are constants. Step 4: Plot the polynomials formed in step 2 and step 3 along with given data in a single figure.
Note: Your code should not take any input from user.
Step 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