plotcircle.m
来自「求取大型稀疏矩阵的特征根和特征向量」· M 代码 · 共 45 行
M
45 行
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 + =
减小字号Ctrl + -
显示快捷键?