![]() Evaluate the interpolation function for several input values and check the relative error. The above Scilab instructions will need to be saved in a file called lininterp1d.sci and loaded into the Scilab workspace before calling it. function =lininterp1d(axis,map,x)Įlseif ((x > axis(i)) & (x < axis(i + 1))) ![]() The output of the function will be y, which is the value of the function in the x point. ![]() x: point in which the function will be evaluated.axis: which is an array containing the xN points.The linear interpolation function will have 3 arguments: Define the interpolation function, which is going to use the sample data points and for any give angle, between 0 and 90, will return the sinus of the angle.įor this particular example, we are going to use Scilab for the definition of the interpolation function lininterp1d(axis, map, x). Define the sample data points for the function: x = α Replace the trigonometrical function sin(α), for α between 0° and 90°, with a set of data points, with an relative error less than 2%. One way to overcome this is to sample the trigonometrical function in different points and used linear interpolation to find its value for any given input.Įxample. It’s often the case that embedded applications do not have predefined trigonometrical functions but they are still used in internal calculations. Let’s take as an example the trigonometrical function sin(α). Between these points, the linear interpolation method is applied to estimated the output y of the function for a given input x. Image: Linear interpolation based on a set of data pointsĪ function y(x) can be approximated on a fixed interval by taking several sample points.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |