📄 stdn_pdf.m
字号:
function pdf = stdn_pdf(x)
% PURPOSE: computes the standard normal probability density
% for each component of x with mean=0, variance=1
%---------------------------------------------------
% USAGE: cdf = stdn_pdf(x)
% where: x = variable vector (nx1)
%---------------------------------------------------
% RETURNS: pdf == (nx1) vector containing pdf for each x
%---------------------------------------------------
% Written by TT (Teresa.Twaroch@ci.tuwien.ac.at)
% Updated by KH (Kurt.Hornik@ci.tuwien.ac.at)
% Converted to MATLAB by James P. Lesage, jpl@jpl.econ.utoledo.edu
if (nargin ~= 1)
error('Wrong # of arguments to stdn_pdf');
end;
[r, c] = size(x);
s = r * c;
x = reshape(x, 1, s);
pdf = zeros(1, s);
k = find (isnan(x));
if any (k)
pdf(k) = NaN * ones(1, length(k));
end;
k = find (~isinf(x));
if any (k)
pdf(k) = (2 * pi)^(- 1/2) * exp( - x(k) .^ 2 / 2);
end;
pdf = reshape(pdf, r, c);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -