Yes, YY is a variable in MATLAB. A variable in MATLAB stores some data. Whereas, a function is a piece of code with manipulates data or gives instructions to MATLAB to do some processing. You can use YY as an input argument in a function.
I believe that your professor has asked you to use "secant" and "bisection" methods. You should be able to find functions in MATLAB that can be used for this. I would recommend you to go through the MATLAB documentation to find a function which serves your requirements.
Also, I would recommend you to take MATLAB Onramp training. It is a complimentary training given by MathWorks to learn MATLAB interactively, at your own pace. You can access this through MATLAB Academy.