Question: Write a function [Y] = myLinearInterp(x, y, X) where the inputs x and y are (1 x n) double arrays containing experimental data points, and

Write a function [Y] = myLinearInterp(x, y, X) where the inputs x and y are (1 x n) double arrays containing experimental data points, and X is a (1 x m) double array. Use Matlab Write a function [Y] = myLinearInterp(x, y, X) where the inputs

Problem 2: Write your Interpolation Function Write a function [Y] -myLinearInterp (x, y, X) where the inputs x and y are (1 x n) double arrays containing experimental data points, and X is a (1 x m) double array. You may assume that x and y are in ascending order and have unique elements. The output argument, Y, should be a (1 x m) vector where Y(i) is the linear interpolation of X(i). IMPORTANT: The Y(i) value should be NaN if a X(i) value is outside the range of values in x. IfX(i) is a value contained in x, then the Y(i) value should be the exact value contained iin y that corresponds to the specified x value. You may not use interpI or any built-in MATLAB function that does interpolation. TEST CASE 1 >> [Y] = myLinea r Interp ([0 2 5 8 10], [1 3 4 9 11], -1) NaN TEST CASE 2 >> [Y] = myLinea r interp ([0 2 5 8 10], [1 3 4 9 11], 6) 5.6667 TEST CASE 3 >> [Y] = myLinea r Interp ([0 2 5 8 10], [1 3 4 9 11], 11) NaN TEST CASE 4 >> [Y] = myLinea r Interp ([0 2 5 8 10], [1 3 4 9 11], [-0.5 0 7.4 9.99]) NaN 1.0000 8.0000 10.9900

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!