马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
- % 关于分形树的GUI
- % reference:
- close all
- figure('position',[135 105 646 342]);
- s1='Starting size = ';
- s2='Minimum Size = ';
- s3='Shrink Factor = ';
- s4='Angle = ';
- ss=69.0;
- ms=4.0;
- sf=1.85;
- A=40.0; % 各参数的初值
- axes('position',[0.5,0.1,0.45,0.8])
- Fractree(ss,ms,sf,A);
- set(gcf,'DoubleBuffer','on');
- h1=uicontrol(gcf,'style','slider',...
- 'unit','normalized','position',[0.02,0.7,0.4,0.04],...
- 'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','r',...
- 'SliderStep',[0.01,0.01],'callback',['a=get(h1,''value'');',...
- 'ss=fix(10+189*a);','set(t1,''string'',[s1,num2str(ss)]);',...
- 'Fractree(ss,ms,sf,A);'],'value',(ss-10)/189);
- t1=uicontrol(gcf,'style','text',...
- 'unit','normalized','position',[0.02,0.75,0.4,0.04],...
- 'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','b',...
- 'string','Starting size = 69.0');
- h2=uicontrol(gcf,'style','slider',...
- 'unit','normalized','position',[0.02,0.6,0.4,0.04],...
- 'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','r',...
- 'SliderStep',[0.01,0.01],'callback',['a=get(h2,''value'');',...
- 'ms=fix(1+48*a);','set(t2,''string'',[s2,num2str(ms)]);',...
- 'Fractree(ss,ms,sf,A);'],'value',(ms-1)/48);
- t2=uicontrol(gcf,'style','text',...
- 'unit','normalized','position',[0.02,0.65,0.4,0.04],...
- 'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','b',...
- 'string','Minimum Size = 4.0');
- h3=uicontrol(gcf,'style','slider',...
- 'unit','normalized','position',[0.02,0.5,0.4,0.04],...
- 'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','r',...
- 'SliderStep',[0.01,0.01],'callback',['a=get(h3,''value'');',...
- 'sf=fix(150+349*a)/100;','set(t3,''string'',[s3,num2str(sf)]);',...
- 'Fractree(ss,ms,sf,A);'],'value',(sf*100-150)/349);
- t3=uicontrol(gcf,'style','text',...
- 'unit','normalized','position',[0.02,0.55,0.4,0.04],...
- 'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','b',...
- 'string','Shrink Factor = 1.85');
- h4=uicontrol(gcf,'style','slider',...
- 'unit','normalized','position',[0.02,0.4,0.4,0.04],...
- 'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','r',...
- 'SliderStep',[0.01,0.01],'callback',['a=get(h4,''value'');',...
- 'A=fix(179*a);','set(t4,''string'',[s4,num2str(A)]);',...
- 'Fractree(ss,ms,sf,A);'],'value',A/179);
- t4=uicontrol(gcf,'style','text',...
- 'unit','normalized','position',[0.02,0.45,0.4,0.04],...
- 'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','b',...
- 'string','Angle = 40.0');
- uicontrol(gcf,'style','text',...
- 'unit','normalized','position',[0.04,0.85,0.3,0.12],...
- 'BackgroundColor',[0.8 0.8 0.9],'ForegroundColor','r',...
- 'string','Fractal tree V1.0','fontsize',16,...
- 'fontname','new times roman');
复制代码
[ 本帖最后由 suffer 于 2006-10-9 21:08 编辑 ] |