Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用matlab生成高斯随机过程?_Matlab_Gaussian_Stochastic Process - Fatal编程技术网

如何使用matlab生成高斯随机过程?

如何使用matlab生成高斯随机过程?,matlab,gaussian,stochastic-process,Matlab,Gaussian,Stochastic Process,如何使用Matlab生成均值和单位方差为零的高斯随机过程 高斯随机变量可以通过 w=(1/sqrt(2*pi))*exp(-(t.^2)/2 但是高斯随机过程呢?如果高斯过程是白色的(不同时刻的样本之间没有相关性),只需使用 w = randn(1,n); 其中n是所需的样本数 如果需要在样本之间引入相关性(即,不同时刻的值是相关的),通常的方法是生成白高斯过程,然后应用低通滤波器(使用conv或滤波器)。过程的自相关性由滤波器形状决定 比如说, w = randn(1,500); y = c

如何使用Matlab生成均值和单位方差为零的高斯随机过程

高斯随机变量可以通过

w=(1/sqrt(2*pi))*exp(-(t.^2)/2


但是高斯随机过程呢?

如果高斯过程是白色的(不同时刻的样本之间没有相关性),只需使用

w = randn(1,n);
其中
n
是所需的样本数

如果需要在样本之间引入相关性(即,不同时刻的值是相关的),通常的方法是生成白高斯过程,然后应用低通滤波器(使用
conv
滤波器
)。过程的自相关性由滤波器形状决定

比如说,

w = randn(1,500);
y = conv(w,ones(1,100)/10,'same'); %// apply a simple low-pass filter
plot(w)
hold on
plot(y,'r')
您可以看到,由于滤波器引入的(自动)相关性,滤波后的信号(红色)具有更平滑的时间变化


通过将平均值为0且标准偏差为hRMSE的白噪声通过高斯滤波器
g=exp(-(x.^2)/(cl^2/2)),可以生成具有指定相关长度(cl)和RMSE-高度(hRMSE)的随机高斯过程。

此外,您可以在以下链接下找到Matlab代码:

已转录如下:

function [f,x] = rsgeng1D(N,rL,h,cl)
%
% [f,x] = rsgeng1D(N,rL,h,cl) 
%
% generates a 1-dimensional random rough surface f(x) with N surface points. 
% The surface has a Gaussian height distribution function and a Gaussian 
% autocovariance function, where rL is the length of the surface, h is the 
% RMS height and cl is the correlation length.
%
% Input:    N   - number of surface points
%           rL  - length of surface
%           h   - rms height
%           cl  - correlation length
%
% Output:   f   - surface heights
%           x   - surface points
%
% Last updated: 2010-07-26 (David Bergström).  
%

format long;

x = linspace(-rL/2,rL/2,N);

Z = h.*randn(1,N); % uncorrelated Gaussian random rough surface distribution
                     % with mean 0 and standard deviation h

% Gaussian filter
F = exp(-x.^2/(cl^2/2));

% correlation of surface using convolution (faltung), inverse
% Fourier transform and normalizing prefactors
f = sqrt(2/sqrt(pi))*sqrt(rL/N/cl)*ifft(fft(Z).*fft(F));

顺便说一句,这不是高斯变量的实现,这只是它的PDF格式。高斯随机变量和高斯随机过程之间有区别。后者有无限维,它就像一个
t
的函数,每个不同的
t
产生不同的随机变量@user2942448你心目中的高斯随机过程是什么?@StrategyThinker:当然,而且
randn
允许这样做。但如果没有进一步的限定,我会将“高斯过程”解释为不相关的高斯样本。