标签:
IFS 算法代码
function IFS_draw(M,p) N=300000; for k=1:length(p); eval([‘a‘,num2str(k),‘=reshape(M(‘,num2str(k),‘,:),2,3);‘]); end xy=zeros(2,N); pp=meshgrid(p); pp=tril(pp); pp=sum(pp,2); for k=1:N-1; a=rand-pp; d=find(a<=0); xy(:,k+1)=eval([‘a‘,num2str(d(1)),‘(:,1:2)‘])*xy(:,k)+eval([‘a‘,num2str(d(1)),‘(:,3)‘]); end; P=complex(xy(1,:),xy(2,:)); plot(P,‘y.‘, ‘MarkerFaceColor‘,‘y‘,‘markersize‘,2); axis equal; axis image; axis off; set(gcf,‘Color‘,‘k‘);
M 数据
0.8 | 0 | 0 | -0.8 | 0 | 0 |
0.4 | -0.2 | 0.2 | 0.4 | 1.1 | 0 |
p 数据
0.5 | 0.5 |
展示代码
% M, p 数据已经存为文件 IFS_Mp.mat load(‘IFS_Mp.mat‘); IFS_draw(M,p);
标签:
原文地址:http://www.cnblogs.com/blog-3123958139/p/5522099.html