stick.m
来自「分形计算的几个程序原码」· M 代码 · 共 25 行
M
25 行
t=[1:1000];
t=mod(t,90);
tr=randn(size(t));
r=cos(t).*cos(t*6)+cos(t*9).*cos(tr*9);
x=r.*cos(t+pi/2);
y=r.*sin(t+pi/2);
H=plot(x,y,'.','markersize',2);
k=1;
xlabel('Please press "space" key and stop this program!',...
'fontsize',12,'color','r');
d=0;
while k
s=get(gcf,'currentkey');
if strcmp(s,'space');
clc;k=0;
end
t=t+cos(d+1);
r=cos(t).*cos(t*6)+cos(t*9).*cos(tr*9);
x=r.*cos(t+pi/2);
y=r.*sin(t+pi/2);
set(H,'xdata',x,'ydata',y);
pause(0.1);
end
figure(gcf);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?