


Evaluates the logged UNIVARIATE GAUSSIAN PDF at x.
INPUTS
x [double] m*n matrix of locations,
a [double] m*n matrix or scalar, First GAUSSIAN distribution parameters (expectation)
b [double] m*n matrix or scalar, Second GAUSSIAN distribution parameters (standard deviation).
OUTPUTS
ldens [double] m*n matrix of logged GAUSSIAN densities evaluated at x.
SPECIAL REQUIREMENTS
none

0001 function [ldens,Dldens,D2ldens] = lpdfnorm(x,a,b) 0002 % Evaluates the logged UNIVARIATE GAUSSIAN PDF at x. 0003 % 0004 % INPUTS 0005 % x [double] m*n matrix of locations, 0006 % a [double] m*n matrix or scalar, First GAUSSIAN distribution parameters (expectation) 0007 % b [double] m*n matrix or scalar, Second GAUSSIAN distribution parameters (standard deviation). 0008 % 0009 % OUTPUTS 0010 % ldens [double] m*n matrix of logged GAUSSIAN densities evaluated at x. 0011 % 0012 % 0013 % SPECIAL REQUIREMENTS 0014 % none 0015 0016 % Copyright (C) 2003-2009 Dynare Team 0017 % 0018 % This file is part of Dynare. 0019 % 0020 % Dynare is free software: you can redistribute it and/or modify 0021 % it under the terms of the GNU General Public License as published by 0022 % the Free Software Foundation, either version 3 of the License, or 0023 % (at your option) any later version. 0024 % 0025 % Dynare is distributed in the hope that it will be useful, 0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0028 % GNU General Public License for more details. 0029 % 0030 % You should have received a copy of the GNU General Public License 0031 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0032 0033 if nargin<3, b=1; end 0034 if nargin<2, a=0; end 0035 ldens = -log(b) -.5*log(2*pi) - .5*((x-a)./b).*((x-a)./b) ; 0036 0037 if nargout >1 0038 Dldens = - (1/b)*((x-a)/b) ; 0039 end 0040 0041 if nargout == 3 0042 D2ldens = - (1/b)^2 ; 0043 end