From 434157f611125026c5b569d45fc4346c5293af01 Mon Sep 17 00:00:00 2001 From: Marco Ratto Date: Mon, 7 Nov 2011 09:17:56 +0100 Subject: [PATCH] errors fixed in 2nd order derivatives --- matlab/lpdfgbeta.m | 4 ++-- matlab/lpdfig1.m | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/matlab/lpdfgbeta.m b/matlab/lpdfgbeta.m index 1906161e5..27a3c7fde 100644 --- a/matlab/lpdfgbeta.m +++ b/matlab/lpdfgbeta.m @@ -52,8 +52,8 @@ end if nargout == 3 if length(a)==1 - D2ldens(idx) = -(a-1)./(x(idx)-aa).^2 + (b-1)./(bb-x(idx)).^2 ; + D2ldens(idx) = -(a-1)./(x(idx)-aa).^2 - (b-1)./(bb-x(idx)).^2 ; else - D2ldens(idx) = -(a(idx)-1)./(x(idx)-aa(idx)).^2 + (b(idx)-1)./(bb(idx)-x(idx)).^2; + D2ldens(idx) = -(a(idx)-1)./(x(idx)-aa(idx)).^2 - (b(idx)-1)./(bb(idx)-x(idx)).^2; end end \ No newline at end of file diff --git a/matlab/lpdfig1.m b/matlab/lpdfig1.m index bb0b54078..c0bb8ff77 100644 --- a/matlab/lpdfig1.m +++ b/matlab/lpdfig1.m @@ -53,9 +53,9 @@ end if nargout == 3 if length(s)==1 - D2ldens(idx) = (nu+1)./(x(idx).^2) - 3*s.*x(idx).^2./(x(idx).^4) ; + D2ldens(idx) = (nu+1)./(x(idx).^2) - 3*s(idx)./(x(idx).^4) ; else - D2ldens(idx) = (nu(idx)+1)./(x(idx).^2) - 3*s.*x(idx).^2./(x(idx).^4) ; + D2ldens(idx) = (nu(idx)+1)./(x(idx).^2) - 3*s(idx)./(x(idx).^4) ; end end