## Thursday, February 15, 2007

Please find below the matlab code for creating a long tailed curve as discussed in class today, looks like this if we use a criteria to increase values which is satisfied for large faction of samples it gives a flatter cure(bottom image, hardnes=1, 50% satisfy) and gives long tailed cure if we use a criteria satisfied by a smaller fraction of numbers(top image, hardnes = 10, 10% satisfy)

%

% To build a power law distribution

%

powDist = [1,1000];

for i=1:1000

powDist(1,i)= rand;

end

for j=1:1000

j

hardnes = 10;

s = sum(powDist) * hardnes;

for i=1:1000

if( rand * s / 1000 < powDist( 1,i))

powDist(1,i) = powDist(1,i)+rand;

end

end

end

plot( -1*sort(-powDist));

Subscribe to:
Post Comments (Atom)

## No comments:

Post a Comment