TASK3 OBJECTIVE: Write a function to do useful computation. You should work on t
ID: 3606786 • 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
myinterpolate.m
function yi = myinterpolate(x1, y1, x2, y2, xi)
m = (y1-y2)/(x1-x2);
c = y1 - m.*x1;
yi = m.*xi + c;
end
on console
myinterpolate(21,0.99802,26.7,0.99669,20.19)
ans = 0.99821
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.