poisson3d.m

来自「用matalab开发的随机数生成程序包」· M 代码 · 共 36 行

M
36
字号
function [pproc] = poisson3d(lambda)
% POISSON3D generate and plot Poisson process in the unit cube
% 
% [pproc] = poisson3d(lambda)
%
% Inputs: lambda - intensity of the process
%
% Outputs: pproc - a matrix with 3 columns with coordinates of the
%          points of the process

% Authors: R.Gaigalas, I.Kaj
% v1.2 07-Oct-02

  % the number of points is Poisson(lambda)-distributed
  npoints = poissrnd(lambda);

  % conditioned that the number of points is N,
  % the points are uniformly distributed
  pproc = rand(npoints, 3);

  % plot the process
  scatter3(pproc(:, 1), pproc(:, 2), pproc(:, 3), ...
           5, 5*rand(1, npoints));
  
  % create colour matrices for every point
%  p_col = (pproc-repmat(min(pproc), npoints, 1))./ ...
%	  repmat(max(pproc)-min(pproc), npoints, 1);
  
  % plot the points as points in the colour cube
  % to get a "space" feeling 
%  grid on;
%  scatter3(pproc(:, 1), pproc(:, 2), pproc(:, 3), ...
%           5, p_col);


⌨️ 快捷键说明

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