gcv.m

来自「PSO粒子群寻优算法。 Particle swarm optimization」· M 代码 · 共 58 行

M
58
字号
function  gcv = gcv(x,t)

% gcv:    Applies soft-threshold t to all elements of x and computes the generalized 
%         cross-validation threshold needed by the MINGCV procedure. 
% Usage
%         gcv = gcv(x,t)
% Inputs
%   x	  input wavelet coefficients, length= 2^J
%   t     soft threshold
% Outputs
%   gcv	 generalized cross-validation threshold
%===========
%借用别人的gcv程序
%===========

%x=[1:64];  
%t = 8;

N = length(x);
res = abs(x) - t;
%  test = (res <= 0);
N0 = sum(res <= 0);
y = sign(x).*res.*(res >= 0);

if (N0 == 0)
     gcv = 1000;
else
     gcv = N * (norm(y-x) / N0 )^2 ;
end

% Acknowledgements
%
% This code is based on a Matlab Code written and kindly provided by M. Jansen
%
% Copyright (c) 2001
%
% Anestis Antoniadis, Jeremie Bigot
% Laboratoire IMAG-LMC
% University Joseph Fourier
% BP 53, 38041 Grenoble Cedex 9
% France.
%
% mailto: Anestis.Antoniadis@imag.fr
% mailto: Jeremie.Bigot@imag.fr
%
% and
%
% Theofanis Sapatinas
% Department of Mathematics and Statistics
% University of Cyprus
% P.O. Box 20537  
% CY 1678 Nicosia
% Cyprus.
%
% mailto: T.Sapatinas@ucy.ac.cy      

 

⌨️ 快捷键说明

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