1、实验六迭代与分形实验数学模型选读实验报告实验六迭代与分形实验 姓 名: 张业尧 学科专业: 创新实验学院 创电1101 学号: 201101228 完成日期: 2012.5.14 大连理工大学Dalian University of Technology 目 录问题重述 3相关函数命令 4实现过程 7总结与心得体会 10References 11问题重述自行设计一个生成元,生成一个分形图形,如利用等边三角形作为生成元,产生Koch雪花等。相关函数命令 kochfunction koch(ax,ay,bx,by,limit)u=ax,ay;bx,by;I=sqrt(bx-ax)2+(by-ay)
2、2);if Ilimit cx=ax+(bx-ax)/3; cy=ay+(by-ay)/3; ex=bx-(bx-ax)/3; ey=by-(by-ay)/3; I=sqrt(ex-cx)2+(ey-cy)2); alpha=atan(ey-cy)/(ex-cx); if (ex-cx)M)=k;endI1=image(linspace(x-L,x+L,512),linspace(y-L,y+L,512),N);title(itc=,num2str(c);set(I1,ButtonDownFcn,p=get(gca,currentpoint),Julia(p(1),p(2),p(3),L,c)
3、;); mandelbrot.mfunction M_set(x,y,L);if nargin=3; c=0.58-0.97i;endx1,y1=meshgrid(linspace(x-L,x+L,512),linspace(y-L,y+L,512);c=x1+i*y1;z=zeros(size(c);N=100;S=ones(size(c)*N;M=2;for k=1:N; z=z.2+c; S(abs(z)2)=k; c(abs(z)2)=0; z(abs(z)2)=0;endII=image(linspace(x-L,x+L,512),linspace(y-L,y+L,512),S);s
4、et(II,ButtonDownFcn,p=get(gca,currentpoint),M_set(x,y,L);); IFS_draw.mfunction IFS_draw(M,p);N=30000;for k=1:length(p); eval(a,num2str(k),=reshape(M(,num2str(k),:),2,3););endxy=zeros(2,N);pp=meshgrid(p);pp=tril(pp);pp=sum(pp,2);for k=1:N-1; a=rand-pp; d=find(a subplot(221);Julia(0,0,1);axis square;x
5、label(a); subplot(222);Julia(0,0.5,0.5);axis square;xlabel(b); subplot(223);Julia(-0.1,0.5,0.1);axis square;xlabel(c); subplot(224);Julia(-0.1,0.5,0.05);axis square;xlabel(d);得到如图6-2所示的julia集的图案。编写mandelbrot.m文件,在命令窗口中输入subplot(221);mandelbrot(0,0,2);axis square;xlabel(a);subplot(222);mandelbrot(0.1
6、,-0.8,0.5);axis square;xlabel(b);subplot(223);mandelbrot(0.15,-0.6,0.125);axis square;xlabel(c);subplot(224);mandelbrot(0.145,0.65,0.03);axis square;xlabel(d);得到mandelbrot集的图案,如图6-3所示。编写IFS_draw.m和tree1.m,根据参考文献1中所给出的系统参数,画出树形图案如图6-4所示。总结与心得体会本次实验中了解到一些基本的分形图案,并且对于复杂的分形图案的生成方法有了一定的了解。但自己编写出的雪花生成图案并不理想。希望在今后的学习过程中弄清楚分形迭代系统的原理,最终自己编程实现绘图。References 1 刘正君.MATLAB科学计算与可视化仿真宝典.北京:电子工业出版社,2009.4
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1