rescale.m

来自「kde全称是kernel density estimation.基于核函数的概率」· M 代码 · 共 16 行

M
16
字号
function npd = rescale(npd,factor)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% rescale(P, factor) --  Rescales the KDE "P" proportionally by 
%                           "factor" (a column-vector)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Copyright (C) 2003 Alexander Ihler; distributable under GPL -- see README.txt

N = npd.N;
npd.centers    = npd.centers .* repmat(factor,[1,2*N]);
npd.ranges     = npd.ranges .* max(factor);  % to be safe
npd.means      = npd.means .* repmat(factor,[1,2*N]);
npd.bandwidth     = npd.bandwidth .* repmat(factor.^2,size(npd.bandwidth)./size(factor));

⌨️ 快捷键说明

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