MATLAB: Can someone check the code

homework

I am suppose to create a function m file called myminimum(f,a,b) which takes three inputs:
f: A function handle.
a: A real number.
b: A real number.
Note: You may assume that f(x) is a quadratic function and that a < b.
Does: Finds the minimum value of f(x) on [a, b] keeping in mind that this may occur either at the
critical point (if the critical point is in [a, b]) or at one of the endpoints. You’ll probably
want to use some if statements to check cases.
Returns: The minimum value of f(x) on [a, b].
Here is my code:
function m=myminimum (f,a,b);
syms x;
y=subs(f(x),a);
z=subs(f(x),b);
w=subs(diff(f(x)),0);
m=min(y,z,w);
end
It keeps returning an error. The error says "MIN with two matrices to compare and a working dimension is not supported." Can someone tell me how to fix my code?
Here is some sample data and the correct answers to the same code.
a= myminimum(@(x) x^2+1,-3,2)
a = 1
a = myminimum(@(x) x^2+6*x-3,-2,0)
a = -11
a = myminimum(@(x) -2*x^2+10*x,3,8)
a = -48