source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/lightspeed/graphics/cut_quantile.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

  • Property svn:executable set to *
File size: 525 bytes
Line 
1function [c,b] = cut_quantile(x,n)
2% CUT_QUANTILE   Index of quantiles.
3% cut_quantile(x,n) returns a matrix of quantile numbers, same size as x,
4% ranging 1..n (n is the desired number of quantiles). 
5% The values with number 1 are in the first quantile, etc.
6% [c,b] = quantile(x,n) returns the quantile values selected
7%
8% Example:
9%   cut_quantile(1:10,4)
10
11probs = linspace(0,1,n+1);
12b = quantile(unique(x(:)),probs);
13
14c = zeros(size(x));
15for b_iter = 1:(length(b)-1)
16  c(x >= b(b_iter)) = b_iter;
17end
Note: See TracBrowser for help on using the repository browser.