以下代码在Matlab中实现对数函数和指数函数曲线的绘制,并添加标题、坐标轴标签和图例。代码如下:

x = 0.01:0.1:10;

y1 = log10(x);

y2 = exp(x);

figure(1);

subplot(2, 1, 1);

plot(x, y1, 'k-', 'LineWidth', 1.5);

grid on;

legend('y1=log_{10}(x)', 'Location', 'northeast');

title('对数函数曲线');

xlabel('x');

ylabel('y1');

subplot(2, 1, 2);

plot(x, y2, 'k-', 'LineWidth', 1.5);

grid on;

legend('y2=exp(x)', 'Location', 'northeast');

title('指数函数曲线');

xlabel('x');

ylabel('y2');