% Find and plot the roots of y=-x^2+5 from -3 to 3
xx = -3:0.1:3;
yy = -xx.^2 + 5;  % element-wise for vector use

x0 = [-2 2];    % initial guesses for the roots

for n = 1:length(x0)
    x(n) = fzero('-x^2+5',x0(n));  % find the root
    y(n) = -x(n)^2 + 5;            % evaluate at that root
end

hold on
plot( [-3 3],[0 0],'-.k', xx,yy,'r-' ); 
% Display each root and a label for it on the plot
for n = 1:length(x)
    plot( x(n), y(n), 'bo' );
    text( x(n)-0.5 , y(n)+0.5 , ...
        ['(' num2str(x(n),3) ',' num2str(y(n),1) ')' ] ); 
end
hold off