ellipplot.m

来自「matlab波形优化算法经常要用到的matlab toolbox工具箱:yalm」· M 代码 · 共 30 行

M
30
字号
function [xe,ye]=ellipplot(P,gamma,ecolor,xc)
%DUAL2CELL Internal function for plotting ellipsoid

% Author Johan L鰂berg
% $Id: ellipplot.m,v 1.2 2004/07/02 08:17:30 johanl Exp $

if nargin<4
   xc = zeros(length(P),1);
end

if nargin<3
   ecolor = [1 0 0];
end

if nargin<2
   gamma = 1;
end

P=P/gamma;
P=chol(P);

theta = linspace(-pi,pi,100);
z = [cos(theta); sin(theta)];

x = inv(P)*z;
for n=1:length(x)
  x(:,n)=x(:,n)+xc;
end;

fill(x(1,:),x(2,:),ecolor)

⌨️ 快捷键说明

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