clc;
clear;

% Define x in the interval [1, 100]
x = linspace(1, 100, 1000);

% Compute the two functions
f1 = exp(x);
f2 = x.^3;

% Create a figure window
figure;

% 1. Top left: Linear scale
subplot(2, 2, 1);
plot(x, f1, 'b-', x, f2, 'r--', 'LineWidth', 1.5);
title('Linear Scale');
xlabel('x');
ylabel('f(x)');
legend('f_1(x) = e^x', 'f_2(x) = x^3', 'Location', 'northwest');
grid on;

% 2. Top right: Log-log scale
subplot(2, 2, 2);
loglog(x, f1, 'b-', x, f2, 'r--', 'LineWidth', 1.5);
title('Log-Log Scale');
xlabel('x (log)');
ylabel('f(x) (log)');
legend('f_1(x) = e^x', 'f_2(x) = x^3', 'Location', 'northwest');
grid on;

% 3. Bottom left: Semilog-x scale
subplot(2, 2, 3);
semilogx(x, f1, 'b-', x, f2, 'r--', 'LineWidth', 1.5);
title('Semilog-x Scale');
xlabel('x (log)');
ylabel('f(x)');
legend('f_1(x) = e^x', 'f_2(x) = x^3', 'Location', 'northwest');
grid on;

% 4. Bottom right: Semilog-y scale
subplot(2, 2, 4);
semilogy(x, f1, 'b-', x, f2, 'r--', 'LineWidth', 1.5);
title('Semilog-y Scale');
xlabel('x');
ylabel('f(x) (log)');
legend('f_1(x) = e^x', 'f_2(x) = x^3', 'Location', 'northwest');
grid on;

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: