Question: Hello, I really need some help with Matlab. Here's the problem: Write a function m file that will take a function f, a vector x,
Hello, I really need some help with Matlab.
Here's the problem:
Write a function m file that will take a function f, a vector x, and a calculation type calcType as inputs. It should return either the minimum value of f(), the maximum value of f(), or the average value of f(), over the interval of values defined by x, depending on the value of calcType. You can choose what calcType must be for each case (you can use numbers, words, abbreviations, etc.). Make sure you document your function well so that help processFunc explains clearly what it does and how to use it. Use as your function definition: function [output] = processFunc(f, x, calcType) Write a script m file, which will call your function with the values for f and x in the table below, and confirm you get the indicated values for the minimum, maximum, and average:
And here's the table:
| function (f) | x | Minimum | Maximum | Average |
| f = @(x)sin(x) | linspace(pi/4,pi/2) | .7071 | 1 | .8998 |
| f = @(x)x.^3-4*x.^2+2 | linspace(-4,6) | -126 | 74 | -9.5017 |
| f = @(x) x.^3-4*x.^2+2 | linspace(-2,2) | -22 | 1.9984 | -3.4411 |
Please help!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
