?? dtlsrtx.txt
字號:
摘要: 這個程序用下拉菜單條的方式可變選取參數觀測李薩如圖形.
% 動態李薩如圖形
% x = a sin(nt + c), y = b sin(t)
clc;clear;close all;
a=1;
b=1;
c=1;
t=0:.02:10;
n=2;
x=a*sin(n*t+c*pi);
y=b*sin(t);
% \copyright: zjliu
% Author's email: zjliu2001@163.com
axes('position',[0.1,0.2,0.6,0.6]);
set(gcf,'DoubleBuffer','on');
set(gcf,'name','動態李薩如圖形')
Lp=plot(x,y,'k');
title(['n=',num2str(n),'; a=',num2str(a),...
'; b=',num2str(b),'; c=',num2str(c),'\pi']);
ast={'the range of a parameter','a--->[0.1,10]','b--->[0.1,10]','c--->[0,pi*2]',...
'n--->[1,10]'};
Te=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.22,0.86,0.45,0.07],...
'BackgroundColor',0.7*[1,1,1],'ForegroundColor',[0.1,0.1,0.9],...
'string','the range of a parameter','fontsize',18,...
'fontname','times new roman');
mm=['select a parameter| parameter: a | parameter: b |'...
' parameter: c | parameter: n'];
ss='abcn';
aa=0.1:.1:10;
bb=0.1:.1:10;
cc=[0:.1:2];
nn=1:10;
pp=uicontrol(gcf,'style','popupmenu',...
'unit','normalized','position',[0.7,0.86,0.28,0.06],...
'BackgroundColor',0.7*[1,1,1],'ForegroundColor',[0.1,0.1,0.9],...
'string',mm,'fontsize',12,...
'fontname','times new roman','callback',...
['nu=get(pp,''value'');set(Te,''string'',ast(nu));',...
'if nu>1;qq=eval([ss(nu-1),ss(nu-1)]);for d=qq;',...
'eval([ss(nu-1),''=d;'']);x=a*sin(n*t+c*pi);y=b*sin(t);',...
'title([''n='',num2str(n),''; a='',num2str(a),',...
'''; b='',num2str(b),''; c='',num2str(c),''\pi'']);',...
'set(Lp,''XData'',x,''YData'',y);pause(0.2);end;',...
'text(mean(xlim),mean(ylim),''the end'',''color'',''r'',',...
'''fontsize'',16);end;']);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -