thanks TASK3 OBJECTIVE: Write a function to do useful computation. You should wo
ID: 3606784 • Letter: T
Question
thanks
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
The Matlab function myinterpolate.m
function y = myinterpolate(x1,y1,x2,y2,x)
y = y1+(x-x1)*(y2-y1)/(x2-x1); % Computing the y value corresponding to x
end
Test calling the function and 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.