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

📄 greetings.m

📁 有趣的可视的数值方法 出自网站http://www.mathworks.com/moler
💻 M
字号:
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.if nargin < 1   phi = (1+sqrt(5))/2;endclfshgset(gcf,'color','black','doublebuffer','on')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;endset(stop,'value',0,'string','X','callback','close(gcf)')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -