function IFS_draw(M,p) N=30000; 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,'k.', 'MarkerFaceColor','k','markersize',2); axis equal; clc;clear;close all; M=[0.06,0,0,0.6,0,0;... 0.04,0,0,-0.5,0,1;... 0.46,-0.34,0.32,0.38,0,0.6;... 0.48,0.17,-0.15,0.42,0,1;... 0.43,-0.26,0.27,0.48,0,1;... 0.42,0.35,-0.36,0.31,0,0.8]; p=[0.1,0.1,0.1,0.23,0.23,0.24]; IFS_draw(M,p); axis image; set(gcf,'Color','w');
图像分形的matlab算法,MATLAB IFS 分形算法
最新推荐文章于 2022-03-18 02:03:21 发布