Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 2 Consider the nonlinear function f(x) zel-1, 1]. , 1+sin(2 By using the Matlab function you coded in Exercise 1, determine the Lagrangian interpolant

image text in transcribedimage text in transcribed

Exercise 2 Consider the nonlinear function f(x) zel-1, 1]. , 1+sin(2 By using the Matlab function you coded in Exercise 1, determine the Lagrangian interpolant of f, i.e. the polynomial INf() that interpolates the set of data , f()Ji o. . ,N in the following cases: 1. Evenly-spaced grid with N +1 points rj-1+2 2. Unevenly-spaced grid with N+1 points (Chebyshev-Gauss-Lobatto points) In particular, write a Matlab function test Lagrange interpolation.m function [x,f,P1,P2,P3,P4]-test Lagrange interpolation() that returns the follwing items x: vector of 1000 evenly-spaced nodes in [-1,1] f: vector representing(1) evaluated at x. P1: Lagrangian interpolant of (1) built on the grid (2) with N- 14, and evaluated at x. P2: Lagrangian interpolant of (1) built on the grid (2) with N- 40, and evaluated at x. P3: Lagrangian interpolant of (1) built on the grid (3) with N- 14, and evaluated at x P4: Lagrangian interpolant of (1) built on the grid (3) with N- 40, and evaluated at x. The function should also plot (1) (in blue) and the Lagrangian interpolants (in red) obtained by using both the evenly-spaced and the unevenly-spaced grids for the cases N 14 and N 40 (4 different figures). Each figure should include the graph of f(x), the data points r,f(, and the interpolant llf(x) through those points

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions