[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
weighted histogram
From: |
Naftali Kidron |
Subject: |
weighted histogram |
Date: |
Sat, 27 Aug 2016 00:07:50 +0000 (UTC) |
a quick & dirty weighted histogram
function whist (y,w,n)%________________________________NK
% HISTOGRAM of y [column_vector] WEIGHTED by w in n bins
if nargin < 3
n = 10;
endif
bins = linspace (min (y),max (y)+sqrt (eps),n+1);
h = [];
for k = 1:n
inbin = find (and (y>=bins (k), y<bins (k+1)));
h = [h;sum (w (inbin))];
endfor
figure
x = (bins (1:n) + bins (2:n+1)) / 2;
bar (x,h)
endfunction%____ WHIST __________________date=26-Aug-16
Naftali Kidron
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- weighted histogram,
Naftali Kidron <=