m***e 发帖数: 4 | 1 function sig=FractRnd(beta, n, HuaTu)
%sig=FractRnd(beta, n)
%To generate 1/f^betta noise
%INPUT
% beta is the exponent, a number
% n is the number of synthetic data points
%OUTPUT
% sig is an n-points array
%
if nargin==2
HuaTu=0;
end
len_beta=length(beta);
phi_n=2*pi*rand(1,n);
f=[1:n].^(-beta/2).*exp(i*phi_n(1:n));
sig=real(ifft(f));
sig=(sig-mean(sig))./std(sig);
if HuaTu
%To verify the scaling behavior of power spectral density:
% P(f) ~ 1/f^beta
figure(HuaTu)
F=fft |
|