ex2301.m

来自「关于matlab的编程」· M 代码 · 共 43 行

M
43
字号
%例23-1 MATLAB绘图函数实例
function createfigure(x1, y1)
%CREATEFIGURE(X1,Y1)
%  X1:  vector of x data
%  Y1:  matrix of y data
 
%  Auto-generated by MATLAB on 16-Feb-2006 14:38:25
 
%% Create figure
figure1 = figure('PaperPosition',[0.6345 6.345 20.3 15.23],'PaperSize',[20.98 29.68]);
 
%% Create axes
axes1 = axes('Parent',figure1);
axis(axes1,[0 6.283 -2 2]);
title(axes1,'sin(x)/sin(2x)/sin(3x)');
xlabel(axes1,'x');
ylabel(axes1,'y');
box(axes1,'on');
hold(axes1,'all');
 
%% Create multiple lines using matrix input to plot
plot1 = plot(x1,y1);
 
%% Create text
text1 = text(...
  'Position',[1.136 -0.9532 0],...
  'String','y=sin(x)',...
  'VerticalAlignment','baseline',...
  'Parent',axes1);
 
%% Create text
text2 = text(...
  'Position',[2.266 -0.8947 0],...
  'String','y=sin(2x)',...
  'VerticalAlignment','baseline',...
  'Parent',axes1);
 
%% Create text
text3 = text(...
  'Position',[3.395 0.8947 0],...
  'String','y=sin(3x)',...
  'VerticalAlignment','baseline',...
  'Parent',axes1);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?