⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elec_ellipse_points.m

📁 Matlab下的EEG处理程序库
💻 M
字号:
function [x,y,z] = ellipse(a,b,c,N)
% ELEC_ELLIPSE_POINTS - Generate points on an ellipse
%
% Useage:   [X,Y,Z] = elec_ellipse_points(a,b,c,N)
%
%           a   X radius
%           b   Y radius
%           c   Z radius
%           N   Number of points to generate
%
%           [X,Y,Z]     cartesian points
%
% Example:  [x,y,z] = elec_ellipse_points; surf(x,y,z); shading interp
%

% $Revision: 1.2 $ $Date: 2003/03/02 03:20:44 $

% Licence:  GNU GPL, no implied or express warranties
% History:  08/01 Darren.Weber@flinders.edu.au
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if ~exist('a','var'), a = 20; end
if ~exist('b','var'), b = 15; end
if ~exist('c','var'), c = 15; end
if ~exist('N','var'), N = 124; end

theta = linspace(0,2*pi,N);
phi   = linspace(-pi,pi,N)';

sinphi = sin(phi);
cosphi = cos(phi);
sintheta = sin(theta);
costheta = cos(theta);
invrho = (sinphi*sintheta/a).^2 + (sinphi*costheta/b).^2 + (cosphi*ones(size(theta))/c).^2;
invrho = sqrt(invrho);

x = sinphi*costheta./invrho;
y = sinphi*sintheta./invrho;
z = cosphi*ones(size(theta))./invrho;

return

⌨️ 快捷键说明

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