⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtlsrtx.txt

📁 摘要: 这个程序用下拉菜单条的方式可变选取参数观测李萨如图形.用MATLAB编写
💻 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 + -