function greetings(phi)
% GREETINGS Seasonal holiday fractal.
% GREETINGS(phi) generates a seasonal holiday fractal that depends
% upon the parameter phi. The default value of phi is the golden ratio.
% What happens for other values of phi? Try both simple fractions
% and floating point approximations to irrational values.
% Copyright 2014 Cleve Moler
% Copyright 2014 The MathWorks, Inc.
if nargin < 1
phi = (1+sqrt(5))/2;
end
clf
shg
set(gcf,'menu','none','numbertitle','off','name','Greetings', ...
'color','black')
stop = uicontrol('style','toggle', ...
'units','normal','position',[.95 .95 .04 .04]);
ax = [-60 120 -60 120];
sigma = .4;
n = 100;
z = 0;
while get(stop,'value') == 0 & ...
min(real(z)) > ax(1) & max(real(z)) < ax(2) & ...
min(imag(z)) > ax(3) & max(imag(z)) < ax(4)
z = cumsum(exp(i*(phi*pi*(0:n).^2+sigma)));
plot(z,'g','linewidth',1)
hold on
plot(z(1:100:n+1),'r.','markersize',12);
hold off
axis(ax)
axis off
text(ax(1)+5,ax(3)+5,'Season''s Greetings','color','white',...
'fontsize',2*get(0,'defaulttextfontsize'))
pause(1)
n = n+100;
end
set(stop,'value',0,'string','X','callback','close(gcf)')
greetings.rar_phi
版权申诉
76 浏览量
2022-07-14
03:28:42
上传
评论
收藏 1KB RAR 举报
周楷雯
- 粉丝: 80
- 资源: 1万+
最新资源
- 20240429_112025.m4a
- 91fdd461elb59a4ce8dfcfc46bc283a7.msi
- Image_1715565894150.jpg
- 计算机网络.docx
- Oracle Instant Client for Linux x86-64 (64-bit) Version 11.1.0.7
- dataExpr.tom-block.1.RData
- 实战验证过的最新远程Tomcat调试方式(基于IDEA2023/2024, JDK1.8, TOMCAT9, WIN10的)
- 200SMART与V20变频器RTU通讯.smart
- 天使插件4.019版-成品
- weinxin小程序仿ofo共享单车
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈