MATLAB: How do i make a function with the question below

homeworkMATLAB

This is the only problem I am having with my homework, can someone please show me the steps on how to do this question, Thank you

Best Answer

func2str is a command which converts a function class variable (i.e. your f variable) into a string class variable. A class is basically just the term for what type of data a variable is, and how matlab should work with the variable.
sprintf is a command which prints a string, and is usually used to combine characters, numbers, or other variables into the string.
I suspect you will need to make a slight adjustment to your function to designate your inputs and outputs.
function [x,f] = myFunPlotter(x)
f = @x sqrt(x.)+exp(sin(x));
end
EDIT*
After reading over the prompt again, I think they are looking for you to use the function to actually create the plot, but both the function and range of x should be defined outside the function. That way, it doesn't matter what your function, f, and variable range, x, are and myFunPlotter can be used for any function.
Related Question