valsurethresh2.m

来自「上課所教所有matlab 小波去燥的教程!~非常適合各位的參考!非常好喔!」· M 代码 · 共 30 行

M
30
字号
function thresh = ValSUREThresh2(y)
%
%%%%%%It's My Own Function!!!
%
% ValSUREThresh -- Adaptive Threshold Selection Using Principle of SURE
%  Usage 
%    thresh = ValSUREThresh(y)
%  Inputs 
%    y        2-d Noisy Data with Std. Deviation = 1
%  Outputs 
%    thresh   Value of Threshold
%
%  Description
%    SURE referes to Stein's Unbiased Risk Estimate.
%
    m=length(y);
    x=[];
    for k=1:m
        x=[x y(k,:)];
    end;
    
	a = sort(abs(x)).^2 ;
	b = cumsum(a);
	n = m*m;%length(x);
	c = linspace(n-1,0,n);
	s = b+c.*a;
	risk = (n - ( 2 .* (1:n ))  + s)/n;
    %figure;plot(1:n,risk(1:n));
	[guess,ibest] = min(risk);
	thresh = sqrt(a(ibest));

⌨️ 快捷键说明

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