kernelType = 'gaussian'; tempValues = zeros(1000,1); for i =1:1000 tempValues(i) = normrnd(0,1); end sortedEffortValues = (0:0.01:1)'; h = 1; probValues = -1 * ones(size(sortedEffortValues,1)); for counter = 1:size(sortedEffortValues,1) effToEstimate = sortedEffortValues(counter); %%%% GAUSSIAN KERNEL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if strcmp(kernelType, 'gaussian') == 1 if (effToEstimate/h) > 1 probValues(counter) = 0; else for i = 1:size(tempValues,1) u = (effToEstimate - tempValues(i))/h; if i == counter continue; end probValues(counter) = probValues(counter) + ((1/(2*pi)) * exp(-0.5 * (u)^2)); end probValues(counter) = probValues(counter) / (size(tempValues,1) * h); end end end