?? brownian.m
字號(hào):
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);
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -