gausspdf.m

来自「一个目标跟踪系统的MATLAB 源程序包」· M 代码 · 共 22 行

M
22
字号
% GAUSSPDF.M   Calculate Gaussian (normal) pdf value
% 
% function y=gausspdf(x,mean,cov)
%
% input parameters:
%    x     ----- the pdf value to be evaluated
%    mean  ----- the mean of Gaussian RV
%    cov   ----- the covariance of Gaussian RV
% output parameters:
%    y     ----- the value of the corresponding pdf evaluated at x
function y=gausspdf(x,mean,cov)
% make the inputs x and mean be column vectors
if size(x,2)>1
    x=x';
end
if size(mean,2)>1
    mean = mean';
end

y=exp(-0.5*((x-mean)'*inv(cov)*(x-mean)))/sqrt(det(2*pi.*cov));

⌨️ 快捷键说明

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