noisecut.m

来自「matlab时频工具箱」· M 代码 · 共 72 行

M
72
字号
%function noisecut%NOISECUT Unit test for the function NOISECU.%	O. Lemoine - May 1996.N=32768;sig=noisecu(N);% MeanMean=mean(sig);if abs(Mean)>10/sqrt(N), error('noisecu test 1 failed');end% VarianceVar=std(sig).^2;if abs(Var-1)>10/sqrt(N), error('noisecu test 2 failed');end% histogramsig=noisecu(N);Nh=100;h=hist(real(sig),Nh); h=h/mean(h);pdf=ones(1,Nh);if any(abs(h-pdf).^2>10/sqrt(N)), error('noisecu test 3 failed');end% For N=1 N=1; Np=10000;for k=1:Np, sig(k)=noisecu(N);endMean=mean(sig);if abs(Mean)>10/sqrt(Np), error('noisecu test 4 failed');endVar=std(sig).^2;if abs(Var-1)>10/sqrt(Np), error('noisecu test 5 failed');endh=hist(real(sig),Nh); h=h/mean(h);if any(abs(h-pdf).^2>10/sqrt(Np)), error('noisecu test 6 failed');end% For N=2N=2;for k=1:2:(Np-1), noise=noisecu(N); sig(k)=noise(1); sig(k+1)=noise(2);endMean=mean(sig);if abs(Mean)>10/sqrt(Np), error('noisecu test 7 failed');endVar=std(sig).^2;if abs(Var-1)>10/sqrt(Np), error('noisecu test 8 failed');endh=hist(real(sig),Nh); h=h/mean(h);if any(abs(h-pdf).^2>10/sqrt(Np)), error('noisecu test 9 failed');end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?