MATLAB: Is there an error? Unbalanced or unexpected parenthesis or bracket.

error unbalanced or unexpected parenthesis or bracket.MATLAB

Error: File: golden.m Line: 1 Column: 21
Unbalanced or unexpected parenthesis or bracket.
function golden(sqrt(2), sqrt(28))
t=[sqrt(2):0.01:sqrt(28)];
plot(t, arrayfun(@f,t));
hold on
tol=10^(-12);
r=(3-sqrt(5))/2;
c=sqrt(2)+r*(sqrt(28)-sqrt(2));
d=sqrt(28)-r*(sqrt(28)-sqrt(2));
fa=f(sqrt(2));
fb=f(sqrt(28));
fc=f(c);
fd=f(d);
while (sqrt(28)-sqrt(2)>tol)
if (fc<fd)
sqrt(28)=d;
fb=fd;
d=c;
fd=fc;
c=sqrt(2)+r*(sqrt(28)-sqrt(2));
fc=f(c);
plot(c,fc,'r*');
else
sqrt(2)=c;
fa=fc;
c=d;
fc=fd;
d=sqrt(28)-r*(sqrt(28)-sqrt(2));
fd=f(d);
plot(d,fd,'r*');
end
end
fprintf('Minimum found at x=%.12f \n', (sqrt(2)+sqrt(28))/2, f(sqrt(2)+sqrt(28))/2);
hold off
end

Best Answer

sqrt(2) and sort(28) are not a valid variable name
replace sqrt(2) and sqrt(28) every with A and B
function golden (A,B)
t = A:0.01:B ;
.. etc ..