I am working on a project for a class and the professor is requiring that we use functions for evaluating certain things (using the bisection and secant method), but he also requires that we only turn in a single .m file. Normally I would create the functions in seperate files and then call them in the main code, but he does not want this. He insists there is a way to do multiple "subroutines" (his phrasing, although I havent heard of that and when I look it up it seems to be the same thing as a function. The main problem is if I try and put a function into my main project code named project1.m it says that the function (bisect) is not the same as the file name, which is why I've always done them seperately. I have looked throughout these forums and the methods I've seen dont seem to make much sense. Ill put a shortened version of my code, as the guts of it don't matter since they run fine. Overall i need a way to have two funcitons or "subroutines" in one .m file and be able to call them. The main problem is having them in the same file and using them all in the same script.
function [p,i] = bisect(f,a,b,tol,n0)
% code for evaluating the function
[p,i] = bisect(f,a,b,tol,n0);