Question: Write a ( pretty useless ) function function printstuff ( func , values ) that takes a func - tion handle func of a function

Write a (pretty useless) function function printstuff(func,values) that takes a func-
tion handle func of a function that takes one argument and returns one number, evaluates
that function at the points given in the vector values , and prints the values to the screen.
The output should look like this:
>> myfunc = @(x)1+x^2;
>> printstuff(myfunc,[0,3,5]);
Function evaluated at 3 points:
for x =0.000000 the value is 1.000000
for x =3.000000 the value is 10.000000
for x =5.000000 the value is 26.000000
Hint: Use a for loop and fprintf (look up fprintf in the MATLAB help)

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!