This preview shows page 1. Sign up to view the full content.
Unformatted text preview: samples = 2*rand(N,1); % Draw samples from uniform distribution on [0,2] range = -1:0.01:3; % Range over which we plot the estimated distribution p=zeros(length(range),1); % Estimated pdf for r=1:length(range) [V,ind]=sort(abs(range(r)-samples)); % Sort the samples by distance from the point left=min(samples(ind(1:k))); right=max(samples(ind(1:k))); V = max(range(r),right)-min(range(r),left); % Define volume such that k samples are included in it p(r) = (1/(N*V))*k; end plot(range,p)...
View Full Document
This note was uploaded on 10/26/2009 for the course CMSC 828 taught by Professor Staff during the Fall '05 term at Maryland.
- Fall '05