Question: Write a MATLAB function that defines the following hat function f(x)=1+x,if1x01x,if0 1 The first line of your function should read: functionfvals=HatFun(xvals) Like many built-in functions

 Write a MATLAB function that defines the following hat function f(x)=1+x,if1x01x,if01

Write a MATLAB function that defines the following hat function

f(x)=1+x,if1x01x,if01 The first line of your function should read: functionfvals=HatFun(xvals) Like many built-in functions in MATLAB, your function should allow the input xvals to be a vector. That is, given a list of inputs x1,x2,,xn stored in xvals, your function should generate a list of outputs f(x1),f(x2),,f(xn) stored in fvals

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!