exm07232_1.m

来自「这是本人收集的一些程序源代码」· M 代码 · 共 26 行

M
26
字号
%exm07232_1.m
clf;shg,t=6*pi*(0:100)/100;y=1-exp(-0.3*t).*cos(0.7*t);
tt=t(find(abs(y-1)>0.05));ts=max(tt);									%<2>
subplot(1,2,1),plot(t,y,'r-','LineWidth',3),grid on				%<3>
axis([0,6*pi,0.6,max(y)])													%<4>
title('y=1-exp(-alpha*t)*cos(omega*t)')								%<5>
text(11,1.25,'alpha=0.3');text(11,1.15,'omega=0.7')
hold on;plot(ts,0.95,'bo','MarkerSize',10);hold off				%<7>
text(ts+1.5,0.95,['ts=' num2str(ts)])
xlabel('t -->'),ylabel('y -->')											%<9>
subplot(1,2,2),plot(t,y,'r-','LineWidth',3)							%<10>
axis([-inf,6*pi,0.6,inf])													%<11>
set(gca,'Xtick',[2*pi,4*pi,6*pi],'Ytick',[0.95,1,1.05,max(y)])	%<12>
grid on																			%<13>
title('\it y = 1 - e^{ -\alphat}cos{\omegat}')						%<14>
text(13.5,1.2,'\fontsize{12}{\alpha}=0.3')							%<15>
text(13.5,1.1,'\fontsize{12}{\omega}=0.7')							%<16>
hold on;plot(ts,0.95,'bo','MarkerSize',10);hold off				%<17>
cell_string{1}='\fontsize{12}\uparrow';								%<18>
cell_string{2}='\fontsize{16} \fontname{隶书}镇定时间';			%<19>
cell_string{3}='\fontsize{6}  ';											%<20>
cell_string{4}=['\fontsize{14}\rmt_{s} = ' num2str(ts)];			%<21>
text(ts,0.85,cell_string)													%<22>
xlabel('\fontsize{14} \bft \rightarrow')								%<23>
ylabel('\fontsize{14} \bfy \rightarrow')								%<24> 

⌨️ 快捷键说明

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