📄 tree.m
字号:
theta=pi/6;
u =[0,0;0,1];
subplot(2,3,1)
plot(u(:,1),u(:,2))
axis([-0.5,0.5,0,1])
for n=1:5
uuu=[];
for I=0:(length(u)/2-1)
p1=(u(2*I+1,:)*2+u(2*I+2,:))/3 ;
p2=(u(2*I+1,:)+u(2*I+2,:)*2)/3;
lp=[cos(theta),-sin(theta);sin(theta),cos(theta)]*...
[(u(2*I+2,1)-u(2*I+1,1));u(2*I+2,2)-u(2*I+1,2)]/3 ;
lp=p1+lp';
rp=[cos(theta),sin(theta);-sin(theta),cos(theta)]*...
[(u(2*I+2,1)-u(2*I+1,1));u(2*I+2,2)-u(2*I+1,2)]/3;
rp=p2+rp';
uu=[u(2*I+1,:);p1;p1;lp;p1;p2;p2;rp;p2;u(2*I+2,:)];
uuu=[uuu;uu];
end
u=[uuu];
subplot(2,3,n+1)
plot(u(:,1),u(:,2))
axis([-0.5,0.5,0,1])
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -