Question: Where indicated below, complete the function, linspline ( ) , which takes two input vectors of data points x and y , of any length
Where indicated below, complete the function, linspline which takes two input vectors of data points x and y of any length n either both column or row and scalar input, a It computes output, s which is the linear function,, evaluated at a:
where a is on
This function is one linear function ie one line in the piecewise linear function on the entire interval,:
i The function linspline will first search for the value of k where To accomplish this, linspline will call a modified version of the binary search function disussed in class. Modify the code per the instructions in the comments below.
ii Then, the code will evaluate for just the interval For example, if the value of were between and k then it would only evaluate s Assume that and but that are not necessarily evenlyspaced.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
