I'm trying to make use of the weibull distribution function to find the spread of wind speeds for my dissertation project.I am also using the modified maximum likelihood theory to find the values for the scale and shape parameters.

The equations I have for each are as follows:

where k is the shape parameter and c the scale parameterI have constructed a script in MATLAB in order to try solve this with the wind speed data I have but for some reason I just cant seem to get the right values.Can anyone see where I may be going wrong?

Code:

data = xlsread('1.xlsx', 1, 'A2:A8076');
[P,V]=hist(data);k=2;q=[1:10];
A=sum((V(:,q).^k).*log(V(:,q)).*P(:,q));
B=sum((V(:,q).^k).*P(:,q));
C=sum((log(V(:,q))).*P(:,q));
D=sum(data>=0);
while any(k-(((A/B)-(C/D))^-1))^2)>0.000001
k=k-0.0000001;
end
format('long')
k
c = (((1/sum(data~=0))*(sum((V(:,q).^1.5)))))^(1/1.5)
end