pdf1d

# pdf1d - function[p,x,P]=pdf1d(xdata,xbins[p,x,P =...

This preview shows pages 1–2. Sign up to view the full content.

function [p,x,P]=pdf1d(xdata,xbins) % [p,x,P] = pdf1d(xdata,M) or [p,x] = pdf1d(ydata,xbins) % % xdata : Vector of data samples. % xbins : If xbins is a scalar, uses xbins equally spaced bins between % min(xdata) and max(xdata). If xbins is a vector, uses bins with % centers specified in vector xbins. OPTIONAL: Default xbins=10. % % p : Vector of the pdf value estimates at the bins with centers given % in x % x : Vector of bin centers. % P : Vector of the corresponding PDF (CDF) value estimates at the % bins with centers given in x % % Finds the histogram-based pdf estimate of p_X(x) and PDF (CDF) estimate of % P_X(x) given the data in xdata. Uses the MATLAB function "hist.m" to % generate the bin counts. Then normalizes them so pdf "integrates" to 1. If % no output argument is given plots the estimate via plot(x,p) or plot(x,P) % % W. C. Karl % if nargin == 0 error('Requires one or two input arguments.') end if nargin == 1 xbins = 10; end Npts = length(xdata); N %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Find bin boundaries and widths

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

pdf1d - function[p,x,P]=pdf1d(xdata,xbins[p,x,P =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online