Scilab/C4/Interpolation/English-timed
From Script | Spoken-Tutorial
Time | Narration |
00:01 | Dear Friends, Welcome to the Spoken Tutorial on Numerical Interpolation. |
00:06 | At the end of this tutorial, you will learn how to: |
00:10 | Develop Scilab code for different Numerical Interpolation algorithms |
00:16 | Calculate new value of function from given data points. |
00:21 | To record this tutorial, I am using |
00:24 | Ubuntu 12.04 as the operating system |
00:27 | and Scilab 5.3.3 version. |
00:31 | To practice this tutorial, a learner should have |
00:34 | basic knowledge of Scilab |
00:36 | and should know Numerical Interpolation. |
00:40 | To learn Scilab, please refer to the relevant tutorials available on the Spoken Tutorial website. |
00:47 | Numerical interpolation is a method of |
00:51 | constructing new data points |
00:53 | within the range of a discrete set of known data points. |
00:59 | We can solve interpolation problems using numerical methods. |
01:05 | In Lagrange interpolation, |
01:07 | We pass a polynomial of degree N – 1 through N points. |
01:12 | Then, we find the unique N order polynomial y of x which interpolates the data samples. |
01:22 | We are given the natural logarithm values for nine, nine point five and eleven. |
01:29 | We have to find the value of natural logarithm of nine point two. |
01:35 | Let us solve this problem using Lagrange interpolation method. |
01:41 | Let us look at the code for Lagrange interpolation. |
01:46 | We define the function Lagrange with arguments x zero, x, f and n. |
01:53 | X zero is the unknown interpolation point. |
01:57 | x is the vector containing the data points. |
02:01 | f is the vector containing the values of the function at corresponding data points. |
02:08 | And n is the order of the interpolating polynomial. |
02:14 | We use n to initialize m and vector N. |
02:19 | The order of the interpolating polynomial determines the number of nodes created. |
02:25 | Then, we apply Lagrange interpolation formula |
02:29 | to find the value of the numerator and denominator. |
02:35 | Then we divide the numerator and denominator to get the value of L. |
02:41 | We use L to find the value of the function y at the given data point. |
02:48 | Finally we display the value of L and f of x f(x). |
02:53 | Let us Save and execute the file. |
02:57 | Switch to Scilab console to solve the example problem. |
03:02 | Let us define the data points vector. |
03:05 | On the console, type: |
03:07 | x equal to open square bracket nine point zero comma nine point five comma eleven point zero close square bracket. |
03:18 | Press Enter. |
03:21 | Then type: f equal to open square bracket two point one nine seven two comma two point two five one three comma two point three nine seven nine close square bracket |
03:39 | Press Enter . |
03:41 | Then type x zero equal to nine point two |
03:46 | Press Enter. |
03:48 | Let us use a quadratic polynomial interpolating polynomial. |
03:53 | Type n equal to two. |
03:58 | Press Enter. |
04:00 | To call the function, type: |
04:02 | y equal to Lagrange open parenthesis x zero comma x comma f comma n close parenthesis |
04:14 | Press Enter. |
04:16 | The value of the function y at x equal to nine point two is displayed. |
04:22 | Let us look at Newton's Divided Difference Method. |
04:26 | In this method, Divided Differences recursive method is used. |
04:32 | It uses lesser number of computation than Lagrange method. |
04:38 | In spite of this, the same interpolating polynomial, as in Lagrange method, is generated. |
04:47 | Let us solve this example using Divided Difference method. |
04:52 | We are given the data points and |
04:54 | the corresponding values of the function at those data points. |
05:00 | We have to find the value of the function at x equal to three. |
05:05 | Let us look at the code for Newton Divided Difference method. |
05:11 | Open the file Newton underscore Divided dot sci on Scilab Editor. |
05:18 | We define the function Newton underscore Divided with arguments x, f and x zero. |
05:29 | x is a vector containing the data points, |
05:33 | f is the corresponding function value and |
05:36 | x zero is the unknown interpolation point. |
05:41 | We find the length of vector and then equate it to n. |
05:46 | The first value of vector is equated to a of one a(1). |
05:51 | Then we apply divided difference algorithm and compute the divided difference table. |
05:57 | Then we find the coefficient list of the Newton polynomial. |
06:03 | We sum the coefficient list to find the value of the function at given data point. |
06:10 | Save and execute the file Newton underscore Divided dot sci. |
06:16 | Switch to Scilab console. |
06:19 | Clear the screen by typing c l c. |
06:22 | Press Enter. |
06:24 | Let us enter the data points vector. |
06:27 | Type: x equal to open square bracket two comma two point five comma three point two five comma four close square bracket |
06:39 | Press Enter. |
06:41 | Then type values of the function |
06:44 | f equal to open square bracket zero point five comma zero point four comma zero point three zero seven seven comma zero point two five close square bracket |
07:01 | Press Enter. |
07:03 | Type x zero equal to three |
07:06 | Press Enter. |
07:08 | Then call the function by typing |
07:11 | I P equal to Newton underscore Divided open parenthesis x comma f comma x zero close parenthesis |
07:23 | Press Enter. |
07:25 | The value of y at x equal to three is shown. |
07:30 | Let us summarize this tutorial. |
07:33 | In this tutorial, we have learnt to develop Scilab code for interpolation methods. |
07:40 | We have also learnt to find the value of a function at new data point. |
07:46 | Solve this problem on your own using Lagrange method and Newton's Divided Difference method. |
07:54 | Watch the video available at the link shown below. |
07:57 | It summarizes the Spoken Tutorial project. |
08:00 | If you do not have good bandwidth, you can download and watch it. |
08:05 | The spoken tutorial project Team: |
08:07 | Conducts workshops using spoken tutorials |
08:10 | Gives certificates to those who pass an online test. |
08:14 | For more details, please write to contact@spoken-tutorial.org |
08:22 | Spoken Tutorial Project is a part of the Talk to a Teacher project. |
08:26 | It is supported by the National Mission on Eduction through ICT, MHRD, Government of India. |
08:33 | More information on this mission is available at http://spoken-tutorial.org/NMEICT-Intro. |
08:38 | This is Ashwini Patil, signing off. |
08:41 | Thank you for joining. |