?? gen_points.m
字號:
function X = gen_points (cmd, a, b, nofpts, myeps, seed);%GEN_POINTS Generate points for fit-ell-lsq%% X = gen_points (cmd, a, b, nofpts, myeps, seed);% gets 'nofpts' points, of different kind.% if (nargin < 6), rand('seed', 0); else rand('seed', seed); end if (nargin < 5), myeps = 0.5; end if (nargin < 4), nofpts = 8; end if (nargin < 2), a = 20; b = 10; elseif (nargin < 3), b = a/2; end if (strcmp(cmd, 'spec1')), X = a/20*[[1 2 5 7 9 3 6 8]', [7 6 8 7 5 7 2 4]']; elseif (strcmp(cmd, 'spec2')), X = a/20*[[1 2 5 7 9 6 3 8]', [7 6 8 7 5 7 2 4]']; elseif (strcmp(cmd, 'rand')), X = a * rand (nofpts, 2); elseif (strcmp(cmd, 'circle')), phi = 2 * pi * rand (nofpts, 1); X = [a * cos(phi), a * sin(phi)]; elseif (strcmp(cmd, 'circle_rand')), phi = 2 * pi * rand (nofpts, 1); X = [a * cos(phi), a * sin(phi)] + myeps * a * (rand(nofpts, 2) - 0.5); elseif (strcmp(cmd, 'ellipse')), phi = 2 * pi * rand (nofpts, 1); X = [a * cos(phi), b * sin(phi)]; elseif (strcmp(cmd, 'ellipse_rand')), phi = 2 * pi * rand (nofpts, 1); X = [a * cos(phi), b * sin(phi)] + myeps * a * (rand(nofpts, 2) - 0.5); elseif (strcmp(cmd, 'hyperbola')), phi = rand (nofpts, 1) - 1/2; phi = phi/log(a+b+2); X = [a * cosh(phi), b * sinh(phi)]; elseif (strcmp(cmd, 'hyperbola_rand')), phi = rand (nofpts, 1) - 1/2; phi = phi/log(a+b+2); X = [a * cosh(phi), b * sinh(phi)] + myeps * a * (rand(nofpts, 2) - 0.5); elseif (strcmp(cmd, 'ginput1')), X = a*[... 0.0970 0.1877 0.1432 0.2375 0.2471 0.3314 0.2818 0.4076 0.3256 0.4604 0.4203 0.5308 0.4688 0.5777 0.5289 0.6422 0.5797 0.7478 0.6905 0.8123 0.8176 0.8299 0.8106 0.6862 0.7667 0.6246 0.7367 0.5748 0.6005 0.4780 0.5289 0.4106 0.4688 0.3519 0.4688 0.3519 0.3788 0.2199 0.2910 0.1965 0.2240 0.1466 0.1501 0.1349 ]; else error ('unknown command'); endend % gen_points
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -