Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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: n y = f(x) k=1 where x is a vector and n is the length of the vector x. 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 f(x) = x2 + 5 and the variable x=1:100. In other words, the function is effectively evaluating the sum Ek (x + 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

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

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

More Books

Students also viewed these Databases questions

Question

=+5 Evaluate whether the CCT program was effective.

Answered: 1 week ago

Question

=+Identify the type of global assignment for which CCT is needed.

Answered: 1 week ago