Question: 5 . Construction of user - defined functions ( numerical solvers ) Write a user - defined function called FunTest 2 with input variables fun

5. Construction of user-defined functions (numerical solvers)
Write a user-defined function called FunTest2 with input variables fun and x and output
variable y. This function takes in an anonymous function input fun and a vector variable x
(assume this vector to be doubles). The function evaluates the sum of the input fun at x and
outputs the result as y. In other words, the function performs the mathematical operation:
=
=1
()
where is a vector and is the length of the vector . The first line of your user-defined
function should look like this:
function y = FunTest2(fun,x)
Note: You may use the partially completed m-file FunTest2.m provided. Copy and paste the
completed m-file below. Remember to remove part from file name before execution.
Test your result with the function ()=2+5 and the variable x=1:100. In other words, the
function is effectively evaluating the sum 100
=1(2+5). You may want to double check your
result by directly evaluating the summation

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!