Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB Code, please do * exactly * as instructions and code says b ) Where indicated below, complete the function, linspline ( ) , which

MATLAB Code, please do *exactly* as instructions and code says
b) 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 Sk-1(a), the linear function, Sk-1(x), evaluated at a:
Sk-1(a)=yk-1+yk-yk-1xk-xk-1(a-xk-1) where aisonxk-1,xk.
(This function is one linear function (i.e., one line) in the piecewise linear function on the entire interval, x1,xn :
S(x)={S1(x),[x1,x2)S2(x),[x2,x3)S3(x),[x3,x4)vdots,Sn-1(x),[xn-1,xn]
i) The function linspline() will first search for the value of k, where xk-1axk. 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 Sk-1(a) for just the interval xk-1,xk. For example, if the value of a were between x7 and x8(k=8), then it would only evaluate s=
y7+y8-y7x8-x7(a-x7). Assume that x1axn and x1,x2,dots,xnx1, but that x1,x2,dots,xn are not necessarily evenly-spaced.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions