📄 plotcircle.m
字号:
function [] = plotcircle(rad,plotfig)% call : plotcircle(rad)% task% Draws circle with the given radius.%% input% rad : radius of the circle which will be drawn% plotfig : figure handle, if no figure with this handle% exists, a new figure will be opened, otherwise% the circle will be drawn on the figure with% handle plotfig.% output% no outputnum_of_points = 1000; rads = rad * rad;xv = [];yv = [];inc = 4*rad / num_of_points;x = -rad;while x < +rad xv = [xv x]; y = sqrt(rads - x*x); yv = [yv y]; x = x + inc;endx = +rad;while x > -rad xv = [xv x]; y = -sqrt(rads - x*x); yv = [yv y]; x = x - inc;endxv = [xv xv(1)];yv = [yv yv(1)];figure(plotfig);plot(xv,yv,'r-');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -