|
看看下面这个吧
转载自紫丁香bbsmatlab版主秋天的萝卜个人blog。- function leaf_by_recursion(n);
- % Renference:
- % http://www.cnartla.com/shejililun/lilun/200508/71.html
- % Author's emal:zjliu2001@163.com
- %
- if nargin==0;
- n=2;
- end
- close all;
- hold on;
- LRf(n,i,pi*0.4,1);
- axis equal
- function LRf(n,z,A,r);
- q=0.85;
- R=0.36*pi;
- s=0.76;
- sc=0.45;
- ss=0.2;
- zz=z;
- for k=1:11;
- zz(k+1)=zz(k)+r*q^k*exp(i*A);
- end
- plot(zz);
- rr=2*r;
- for k=1:10;
- z1=zz(k+1)+rr*s^k*exp(i*(A+R));
- z2=zz(k+1)+rr*s^k*exp(i*(A-R));
- plot([z1,zz(k+1),z2]);
- end
- if n>0;
- for k=2:10;
- LRf(n-1,zz(k),A+R,r*sc*q^k);
- LRf(n-1,zz(k),A-R,r*sc*q^k);
- LRf(n-1,zz(k),A,r*ss*q^k);
- end
- LRf(n-1,zz(1),A,r/2*sc*q);
- LRf(n-1,zz(11),A,r*ss*q^10);
-
- end
复制代码 |
|