The following MATLAB code is used by Dattatreya et al in the book ‘Angular Statistics’ to find the mle of a certain probability distribution.
function [fun]=w_eiw_fminmle(X)
th=[8 9 13 13 14 18 22 27 30 34383840 44 45 47 48 48 48 48 50 53 56 57 58 58 61 63 64 64 64 65 65 68 70 73 78 78 78 83 83 88 88 88 90 92 92 93 95 96 98 100 103 106 113 118 138 153 153 155 204 215 223 226 237 238 243 244 250 251 257 268 285 319 343 350];
th=th.*pi./180;
th=sort(th);
n=76;
c=X(1)
lambda=X(2)
m=5;
g=0;
for k=0:m
g=g+((lambda.*c).*((th+2*k*pi)).^(-(c+1))).*(exp(-(th+2*k*pi).^(-c)).^lambda);
end
fun=0;
for i=1:n
fun=fun+log(g(i));
end
fun=-(fun);
return
I tried to run this code in MATLAB and receive an error stating that X is unidentified. How do I fix this error?