例5-30.m

来自「这是一个MATLAB7.0基础与提高例题的所有源码」· M 代码 · 共 20 行

M
20
字号
%先创建橘黄色划线,线的颜色[1,0.5,0]:
>> x=-2*pi:pi/40:2*pi;  	%  create data
>> y=sin(x);  			%  find the sine of x
>> Hl_sin=plot(x,y)  		%  plot sine and save line handle
>> set(Hl_sin,'Color',[1 .5 0],'LineWidth',3)  %  Change the color and width
%现在加一个浅蓝色的cosine曲线:
>> z=cos(x);  			%  find the cosine of x
>> hold on  			%  keep the sine curve
>> Hl_cos=plot(x,z);  	%  plot the cosine and save the handle
>> set(Hl_cos, 'Color',[.75  .75  1])  		%  color it light blue
>> hold off
%加上一个标题并且使字体比正常大一些:
>> title( 'Handle Graphics Example' )  %  add a title
>>  Ht_text=get(gca,'Title' )  			%  get a handle to the title
>> set(Ht_text,'FontSize',16)   			%  customize the font size




⌨️ 快捷键说明

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