torus.m

来自「用matlab实现利用统计混沌方法解决非线性系统时间序列预测的问题」· M 代码 · 共 19 行

M
19
字号
function out = torus(nbr,rad1,rad2);
% The function
% 
%       out = torus(nbr,revo,step);
% 
% generates a 3-dimensional database with <nbr> elements. 
% These elements draw a hollow torus. 
% The optional parameter <rad1> gives the main radius of 
% the torus; default value is 0.75. 
% The optional parameter <rad2> sets the second radius; 
% default value is 0.25.  

if nargin<3, rad2 = 0.25; end;
if nargin<2, rad1 = 0.75; end;

r = 2*pi*rand(nbr,1);
s = 2*pi*rand(nbr,1);

out = [(rad1+rad2*cos(s)).*cos(r), (rad1+rad2*cos(s)).*sin(r), rad2*sin(s)];

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?