📄 circlegen.m
字号:
function circlegen(h)%CIRCLEGEN Generate approximate circles.% CIRCLEGEN(h) uses step size h.% CIRCLE with no arguments uses h = 0.20906.if nargin < 1 h = sqrt(2*(1-cos(2*pi/30)));endshgclfset(gcf,'doublebuffer','on')z = exp(2*pi*i*(0:256)/256);grey = [.8 .8 .8];p = plot(real(z),imag(z),'-',0,0,'o',1,0,'.');set(p(1:2),'color',grey);p = p(3);set(p,'color','black','erasemode','none')axis([-2 2 -2 2])axis squaretitle(['h = ' num2str(h)])stop = uicontrol('style','toggle','string','stop');x = 1;y = 0;while ~get(stop,'value') x = x + h*y; y = y - h*x; set(p,'xdata',x,'ydata',y); drawnowendset(stop,'string','close','value',0,'callback','close')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -