代码拉取完成,页面将自动刷新
clear
%% 设置fig背景为深色模式
back_color = [0.15, 0.15, 0.15];
h_f = figure('Color', back_color);
%% 绘制 sin
sin_axis = subplot(211);
x = linspace(-3*pi, 3*pi, 200);
y = sin(x);
plot(sin_axis, x, y, 'g-');
xlim([-3*pi, 3*pi]);
ylim([-1.2, 1.2]);
% 绘制坐标轴
mdng.DrawAxisWithArrow(sin_axis, 'XLabel', '$x$', 'YLabel', '$\sin x$', 'OLabel', '$O$');
%% 绘制 cos
cos_axis = subplot(212);
y2 = cos(x);
plot(cos_axis, x, y2, 'y-');
xlim([-3*pi, 3*pi]);
ylim([-1.2, 1.2]);
mdng.DrawAxisWithArrow(cos_axis, 'XLabel', '$x$', 'YLabel', '$\cos x$', 'OLabel', '$O$');
%% 保存为图像
if false
img_name = SaveFig2Img(h_f, 'figures\demo02.png');
fprintf('图像保存为: %s\n', img_name);
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。