如何用matlab产生alpha稳定分布
发布网友
发布时间:2022-04-28 21:08
我来回答
共2个回答
热心网友
时间:2022-06-23 05:15
function y = alpharnd(a,n);
% ALPHARND Generates random numbers from an alpha-stable distribution
%
% CALL: y = alpharnd(a,n);
%
% y = a one-column matrix with random numbers,
% a = the parameter alpha,
% n = the number of random numbers.
%
% a = 1 gives the Cauchy distribution and a = 2 the Gaussian distribution.
% Tested on: Matlab 5.3
% History:
% Revised by jr 22.12.1999
y=zeros(n,1);
for i=1:n
cc0=31; cc=0; a1=a-1;
while cc0>30
while cc<0.000001
v=pi*(rand-0.5); cc1=log(cos(a1*v)); cc=cos(v);
end
w=-log(rand); cc=log(cc); cc0=a1*(log(w)-cc1)-cc;
end
x=abs(sin(a*v))*exp(cc0/a);
if rand<0.5, x=-x; end
y(i)=x;
end
热心网友
时间:2022-06-23 05:16
你说的是randn吗
我找到的一个
rand returns pseudorandom numbers from a uniform distribution. 返回随机数服从均匀分布
randn returns pseudorandom numbers from a normal distribution. 返回随机数服从正态分布
randi returns pseudorandom numbers from a uniform discrete distribution.返回随机数服从均匀离散分布