

Predifined Scilab function for interpolationĪfter running the Scilab instruction above, we’ll have displayed in the Scilab console: Interpolation Interpolated Real RelativeĪs you can see, the relative error of the interpolation is less than 2%. Mprintf("%s \t\t %s \t\t %s \t\t %s \n", "Interpolation", "Interpolated", "Real", "Relative") Legend("actual","sample points","interpolated points",2) Using a Scilab script, we are going to evaluate the interpolation function for the following angles α ( x values): 5, 15, 25, 35, 45, 55, 65, 75, 85. 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. Thermodynamics Science Calculators The science of heat, temperature, work, pressure, entropy, enthalpy. function =lininterp1d(axis,map,x)Įlseif ((x > axis(i)) & (x < axis(i + 1))) The calculator uses data points from thermodynamic property tables, and uses linear interpolation to calculate the following six thermodynamic properties. The output of the function will be y, which is the value of the function in the x point. Before the advent of computation, interpolation was widely used to calculate. x: point in which the function will be evaluated Interpolation is one of the very old and basic techniques of numerical calculation.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. In such cases, interpolation is required to obtain the correct value.
