正在加载图片...
Matlab计算与仿真 4.观察指令 legend和rum2str的用法:在同 张图上画出 Peroid and linear peroid function y=sin()和y=3 2-05tt∈[0,3 The linear period functiong(x)? 并进行适当的标注 t=0:01:3pi alpha=0: 0. 1: 3*pi: plot(t, sin(t), r-): hold on: plot(alpha, 3*exp(-05*alpha), k:) 图2.5文字标注 set(gca, 'fontsize, 15, fontname,times New Roman), xlabel( \it(t(deg))) ylabel( \it(magnitude]) title( \it(sine wave and \it(Ae)"(-alpha n \itt]]wave)): %注意 alpha的意义 text(6, sin(6), \fontsize( 15)The Value \it(sin(t)at \itt =6 \rightarrow \bullet HorizontalAlignment, right ), %上面的语句是一整行,如果要写成两行,必须使用续行号…,例如要在" bullet'," %后换行,需写" bullet’,"后才能换行 %' HorizontalAlignment'; right’表示箭头所指的曲线对象在文字的右边。 text(2, 3*exp(-05*2).[\fontsize (15)\bullet\leftarrow The value of lit(3e][0.5 \it(t))=, num2str(3*exp(-0 5*2)), at \itit)=2 D %mum2str的用法:[ string',mum2sr, string2],注意方括号的使用 % legend(' \itsin(t)’,'{\itAe}^{- \alphat})%请结合图形观察此命令的使用 运行结果如图2.6所示。 5.图形窗口的创建和分割 f xelinspace(o, b, 50): for k =1: 9 y=sin(k*×) subplot(3, 3, k): plot(x, y): axis([0, 2 pi, -1, 1]Matlab计算与仿真 4. 观察指令 legend 和 num2str 的用法:在同 一张图上画出 0.5 sin( ) 3 t y t y e− = = 和 , t [0,3] 并进行适当的标注。 zxy2_2.m clf, t=0:0.1:3*pi; alpha=0:0.1:3*pi; plot(t,sin(t),'r-');hold on; plot(alpha,3*exp(-0.5*alpha),'k:'); set(gca,'fontsize',15,'fontname','times New Roman'), xlabel('\it{t(deg)}');ylabel('\it{magnitude}'); title(' \it{sine wave and {\it{Ae}}^{-\alpha{\itt}}wave}'); %注意\alpha 的意义 text(6,sin(6),'\fontsize{15}The Value \it{sin(t)} at {\itt}=6\rightarrow\bullet', … 'HorizontalAlignment','right'), %上面的语句是一整行,如果要写成两行,必须使用续行号 … ,例如要在“ bullet',” %后换行,需写“bullet', …”后才能换行。 % 'HorizontalAlignment','right' 表示箭头所指的曲线对象在 文字的右边。 text(2,3*exp(-0.5*2),['\fontsize{15}\bullet\leftarrow The Value of \it{3e}^{-0.5 \it{t}}=',num2str(3*exp(-0.5*2)),' at \it{t} =2 ']); %num2str 的用法:['string1' ,num2str,'string2'],注意方括号的使用。 %legend('\itsin(t)','{\itAe}^{-\alphat}') % 请结合图形观察此命令的使用 运行结果如图 2.6 所示。 5. 图形窗口的创建和分割 clf, b=2*pi; x=linspace(0,b,50); for k =1:9 y=sin(k*x); subplot(3,3,k); plot(x,y); axis([0,2*pi,-1,1]) end 0 5 10 15 20 25 30 -1 0 1 2 3 4 5 6 Peroid and linear peroid function x y ?? The period function f(x) The linear period function g(x)? ? 图 2.5 文字标注
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有