TASK3 OBJECTIVE: Write a function to do useful computation. You should work on t
ID: 3606785 • Letter: T
Question
TASK3 OBJECTIVE: Write a function to do useful computation. You should work on this task individually, but you may discuss results with your teammates Write a function to perform linear interpolation between two points. Given coordinates x1y2V2 and a value x, find the corresponding y-value of the of the point on the line connecting the points (x,, y,) and (x2,y2) y2 x X2 Do error-checking for nonsensical input. Submit myinterpolate.m to eCampus. Example >> myinterpolate (21 ,0.99802 , 26.7 , 0.99669,20.19) ans 0.9982Explanation / Answer
PLEASE CREATE myinterpolate.m file AND PASTE BELOW CODE
function [y] = myinterpolate(x1,y1,x2,y2,xi)
term = (y2 - y1) / (x2 - x1);
%formula for linear interpolation
y = y1 + term * (xi - x1);
PLEASE REFER BELOW OUTPUT
>> myinterpolate(21, 0.99802, 26.7, 0.99669, 20.19)
ans =
0.9982
>>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.