function y = gam_noise_gen(M, ALPHA, A, B)
%%%%%%%%%%%%%%% 获得均值 =M ,有效视数 =ALPHA 的Gamma Noise%%%%%%%%%%%%
%input: M 均值
% ALPHA 有效视数, 对应Matlab函数[mean,var] = Gamstat(A,B)函数的参数A:形状参数
% B:var,即方差. 均值=A×B;方差=A×B^2。从而可以从A和B换算出mean, var。
%
% A 矩阵行数
% B 矩阵列数
%output: y A×B大小的,服从Gamma分布的噪声矩阵
t=1:1:A*B;
size_t = length(t);
%%常数%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%ALPHA = 4.0; %代表有效视数L, 为保证Mean =1, 一般VAR = ALPHA
%M = 2;
%%计算准备%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Gamma_nosie = zeros(1,size_t);
%%计算%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for k = 1:ALPHA
Rand_A1_Col = rand(1,size_t);
Noise_A1_Col = (-1)*(M/ALPHA)*log(1-Rand_A1_Col);
Gamma_nosie=Gamma_nosie+Noise_A1_Col;
end
Gamma_noise= reshape(Gamma_nosie,A,B);%获得大小为A×B的Gamma噪声矩阵
y = Gamma_noise;
%%显示%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%imshow(y);
%Gammacof = 100; %放大比例
%tmp = uint16(y*Gammacof);
%%直方图
%figure;
%[temp,x]=imhist(uint16(tmp),65536);
%His_Org = temp';
%His_Org = His_Org/sum(His_Org);%归一化
%MaxValue =double(max(max(tmp)));
%His_Org = His_Org(1:MaxValue);
%X_axis = 0:1:MaxValue-1;
%X_axis = X_axis/Gammacof;
%plot(X_axis,His_Org);
gam_noise_gen.zip_GAMMA分布_NOISE_gam_noise_gen_gamma_gamma noise
版权申诉
86 浏览量
2022-07-15
09:40:25
上传
评论
收藏 902B ZIP 举报
钱亚锋
- 粉丝: 86
- 资源: 1万+
评论0