Skip to content

Commit

Permalink
digamma function file
Browse files Browse the repository at this point in the history
  • Loading branch information
tinybike committed Apr 19, 2013
1 parent 77fdea8 commit d6c1a98
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions digamma.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function y = digamma(x,s)

x_max = max(x);
u = zeros(x_max,1);

u(1) = 1;
for jj = 2:x_max
u(jj) = 1/(1+s*(jj-1));
end

if min(x)
w = cumsum(u);
y = w(x);
else
w = [0;cumsum(u)];
y = w(x+1);
end

0 comments on commit d6c1a98

Please sign in to comment.