% Define parameters
x = linspace(3, 10, 1000);
y1 = func3(x);
y2 = func4(x);

% Plot the functions
figure;
plot(x, y1, '-b', x, y2, '-r');
xlabel('x');
ylabel('y');
legend('100e^{-x}', '5sin(\pi x / 2)');
grid on;

% Use Newton's Method to find the root around x0 = 4
f = @(x) func3(x) - func4(x);
df = @(x) -100 * exp(-x) - (5 * pi / 2) * cos(pi * x / 2);

x0 = 4;
tol = 1e-10;
imax = 20;

root = newton(x0, f, df, imax, tol);

% Plot the root
hold on;
plot(root, func3(root), 'ro');
title(['Root at x = ', num2str(root)]);
