function plot_roots(f, roots, x_range)
    % PLOT_ROOTS Plot function and mark roots
    % Inputs:
    %   f       - Function handle
    %   roots   - Array of root positions
    %   x_range - Range of x values for plotting

    x = linspace(x_range(1), x_range(2), 1000);
    y = f(x);
    
    figure;
    plot(x, y, '-b', 'LineWidth', 1.5); hold on;
    plot(roots, f(roots), 'ro', 'MarkerSize', 8, 'LineWidth', 1.5);
    xlabel('x');
    ylabel('f(x)');
    title('Roots of the Function');
    grid on;
end
