求用Mathematica绘制科赫雪花曲线的过程每一步 ,我吧分都给你了

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 21:28:38
求用Mathematica绘制科赫雪花曲线的过程每一步,我吧分都给你了求用Mathematica绘制科赫雪花曲线的过程每一步,我吧分都给你了求用Mathematica绘制科赫雪花曲线的过程每一步,我吧

求用Mathematica绘制科赫雪花曲线的过程每一步 ,我吧分都给你了
求用Mathematica绘制科赫雪花曲线的过程
每一步 ,我吧分都给你了

求用Mathematica绘制科赫雪花曲线的过程每一步 ,我吧分都给你了
[1]科赫雪花曲线是分形曲线,随着N增大,长度趋向于无穷大.
周长和面积只有给出具体的N才有意义,
我下面给出它的计算式
边长通项an=a*(1/3)^(n-1)
边数通项bn=3*(1/4)^(n-1)
面积通项S(n+1)=S(n)+6*(1/4)*√3an^2 S1=(1/4)*√3a1^2
周长通项c(n)=an*bn=3a*(4/3)^n
[2]我这里只有自己编写的现成的MATLAB生成曲线的程序,
不知道可以不可以?
毕竟通过上面我给出的通项公式,可以直观的得到结论(有我给你推倒的通项公式,即时自己计算问题应该不大了
PS:我的MATLAB程序之一(我当初编写的程序有很多,这是其中一个)
x1=[1 2 2.5 3 4];
y1=[0 0 0 0 0];
h1=plot(x1,y1,'linewidth',2,'erasemode','xor');
axis equal
axis off
for g=linspace(0,1,40)*sin(pi/3);
y1(3)=g;
set(h1,'ydata',y1);
drawnow;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x2=x1(1);
y2=y1(1);
for k=2:length(x1);
t=linspace(x1(k-1),x1(k),4) ;
tt=[t(2),mean(t),t(3:4)];
x2=[x2,tt];
t=linspace(y1(k-1),y1(k),4);
tt=[t(2),mean(t),t(3:4)];
y2=[y2,tt];
end
A=angle((y2(4:4:end)-y2(2:4:end))*i+(x2(4:4:end)-x2(2:4:end)));
for g=linspace(0,1,40)*sin(pi/3)/3;
y2(3:4:end)=(y2(4:4:end)+y2(2:4:end))/2+imag(g*exp(i*(A+pi/2)));
x2(3:4:end)=(x2(4:4:end)+x2(2:4:end))/2+real(g*exp(i*(A+pi/2))) ;
set(h1,'ydata',y2,'xdata',x2);
drawnow;
end
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x3=x2(1);
y3=y2(1);
for k=2:length(x2);
t=linspace(x2(k-1),x2(k),4);
tt=[t(2),mean(t),t(3:4)];
x3=[x3,tt];
t=linspace(y2(k-1),y2(k),4);
tt=[t(2),mean(t),t(3:4)];
y3=[y3,tt];
end
A=angle((y3(4:4:end)-y3(2:4:end))*i+(x3(4:4:end)-x3(2:4:end)));
for g=linspace(0,1,40)*sin(pi/3)/9;
y3(3:4:end)=(y3(4:4:end)+y3(2:4:end))/2+imag(g*exp(i*(A+pi/2)));
x3(3:4:end)=(x3(4:4:end)+x3(2:4:end))/2+real(g*exp(i*(A+pi/2)));
set(h1,'ydata',y3,'xdata',x3);
drawnow;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x4=x3(1);
y4=y3(1);
for k=2:length(x3);
t=linspace(x3(k-1),x3(k),4);
tt=[t(2),mean(t),t(3:4)];
x4=[x4,tt];
t=linspace(y3(k-1),y3(k),4);
tt=[t(2),mean(t),t(3:4)];
y4=[y4,tt];
end
A=angle((y4(4:4:end)-y4(2:4:end))*i+(x4(4:4:end)-x4(2:4:end)));
for g=linspace(0,1,40)*sin(pi/3)/27;
y4(3:4:end)=(y4(4:4:end)+y4(2:4:end))/2+imag(g*exp(i*(A+pi/2)));
x4(3:4:end)=(x4(4:4:end)+x4(2:4:end))/2+real(g*exp(i*(A+pi/2)));
set(h1,'ydata',y4,'xdata',x4);
drawnow;
end