|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
function fern
% FERN MATLAB impiementation of the Fractal Fern
% Michael Barnsley, Fractals Everywhere, Academic Press, 1993
% This version runs forever, or until stop is toggled.
% See also: FINITEFERN
shg
clf reset
set (gcf , 'color', 'white','menubar','none' , 'numbertitle','off','name','Fractal Fern')
x = [0.5 ; 0.5];
h = plot(x(1), x(2), ' . ');
darkgreen = [0 2/3 0];
set(h , 'markersize', 1, 'color', darkgreen, 'erasemode', 'none');
axis([-3 3 0 10])
axis off
stop uicontrol('style','toggle','string','stop','background','white');
drawnow
p = [0.85 0.92 0.99 1.00];
A1 = [0.85 0.04; -0.04 0.85]; b1 = [0 ; 1.6];
A2 = [0.20 -0.26; 0.23 0.22]; b2 = [0 ; 1.6];
A3 = [-0.15 0.28; 0.26 0.24]; b3 = [0; 0.44];
A4 = [0 0; 0 0.16];
cnt = 1;
tic
while ~get(stop,'value')
r = rand;
if r < p(1)
x = A1*x + b1;
elseif r < p(2)
x = A2 * x + b2;
elseif r < p(3)
x = A3 * x + b3;
else
x = A4 * x;
end
set(h,'xdata',x(1),'ydata',x(2));
cnt = cnt + 1;
drawnow
end
t = toc;
s = sprintf('%8.0f points in %6.3f seconds' , cnt , t);
text(-1.5 , -0.5 , s , 'fontweight' , 'bold');
set(stop , 'style' , 'pushbutton' , 'string' , 'close' , 'callback' , 'close(gcf)')
end
>> fern
警告: EraseMode 属性不再受支持,而且在以后的版本中会出错。
> In fern (line 13)
未定义与 'char' 类型的输入参数相对应的函数 'stop'。
出错 fern (line 16)
stop uicontrol('style','toggle','string','stop','background','white');
这个怎么改,,,,MATLAB的,来这里碰碰运气,,这是因为这个适应较老的版本,在2018a上不行了,,感谢感谢 |
|