
clear all
close all
clc

N=200000;

U_1 = rand(1,N);
U = rand(1,N);

	for j=1:N
		if U_1(i) > 0.5
			X(i) = -log(U(i));
		else
			X(i) = -log(U(i));	
		end	
	end


	for i = 1000:1000:N
		index = i/1000;
		mean_func(index) = sum(X((1:i)).*exp(abs(X(1:i))-(3/4)*abs(X(1:i))))/sum(exp(abs(X(1:i))-(3/4)*abs(X(1:i))));

		var_func(index) = sum((((X(1:i)-mean_func(index)).^2).*exp(abs(X(1:i))-(3/4)*abs(X(1:i))))/sum(exp(abs(X(1:i))-(3/4)*abs(X(1:i))));

		Kurt_func(index) = sum((((X(1:i)-mean_func(index)).^4)/((var_func(index))^2)).*exp(abs(X(1:i))-(3/4)*abs(X(1:i))))/sum(exp(abs(X(1:i))-(3/4)*abs(X(1:i))));
		
	end

figure(1);
plot(1000:1000:N, mean_func);
title('Mean of function');
text('Mean ='num2str(mean_func(end)));



figure(2);
plot(1000:1000:N, var_func);
title('Variance of function');
text('Variance ='num2str(var_func(end)));


figure(3);
plot(1000:1000:N, Kurt_func);
title('Kurtosis of function');
text('Kurtosis ='num2str(Kurt_func(end)));