?? bm3plot.m
字號:
function [bmproc] = bm3plot(npoints, sigma)
%
% BM3PLOT Generate and plot a 3-dimensional Brownian motion
%
% [bmproc] = brownian3d(npoints [, sigma])
%
% Inputs: npoints - length of the trajectory
% sigma - optional, the norming constant. Default 1.
%
% Outputs: bmproc - npoints x 3 matrix with values of the process
% Authors: R.Gaigalas, I.Kaj
% v1.2 04-Oct-02
% set default parameter values
if (nargin==1)
sigma = 1;
end
% generate a 3-dimensional random walk with normally distributed
% jumps
bmproc = cumsum([zeros(1, 3); sigma^0.5*randn(npoints-1, 3)]);
% plot the process
% first the trajectory in black
plot3(bmproc(:, 1), bmproc(:, 2), bmproc(:, 3), 'k');
% create colour matrices for every point
p_col = (bmproc-repmat(min(bmproc), npoints, 1))./ ...
repmat(max(bmproc)-min(bmproc), npoints, 1);
% plot the jump points as points in the colour cube
% to get a "space" feeling
hold on;
scatter3(bmproc(:, 1), bmproc(:, 2), bmproc(:, 3), ...
10, p_col, 'filled');
grid on;
hold off;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -