用MATLAB产生分形
Posted fpga&matlab
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用MATLAB产生分形相关的知识,希望对你有一定的参考价值。
%Dragon Curve/Fractal generated by mimicking the paper folding method
%Author: James Wood 2013
close all
clear all
clc
angle=0
%amount to rotate the final fractal
iter=20
%number of iterations
D=1;
for j=2:iter;
D2=flipud(~D);
%Make second half of new iteration
%by performing NOT operation and flipping
D(end+1,1)=0;
%make center point 0
D=vertcat(D,D2);
%join 2 halves of new iteration
end
D=D-(~D);
%Changes values from 0,1 -> -1,1 for use with imaginary number
D=1i.^cumsum(D);
%Generates a list of new locations for each element relative to the
%previous element
D=cumsum(D);
%Cumulatively sums the elements to for final image
E=exp(1i*angle*pi/180)*D;
%rotates the final matrix
plot(E)
以上是关于用MATLAB产生分形的主要内容,如果未能解决你的问题,请参考以下文章
日积月累Shader - 09 分形图 / Patterns图案