📄 brownian.m
字号:
function [bmproc] = brownian(npoints, sigma)
% BROWNIAN generate and plot an aproximation to Brownian motion.
% Generates a random walk with normally distributed jumps
%
% [bmproc] = brownian(npoints [, sigma])
%
% Inputs: npoints - length of the trajectory
% sigma - optional, the norming constant (standard
% deviation of B(1)). Default 1.
%
% Outputs: bmproc - trajectory 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 sample from a Gaussian distribution and sum up
bmproc = [0 cumsum(sigma.*randn(1, npoints-1))];
% plot the process
plot([0:npoints-1], bmproc);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -