Last change
on this file since 177 was
37,
checked in by (none), 15 years ago
|
Added original make3d
|
-
Property svn:executable set to
*
|
File size:
525 bytes
|
Line | |
---|
1 | function [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 |
|
---|
11 | probs = linspace(0,1,n+1);
|
---|
12 | b = quantile(unique(x(:)),probs);
|
---|
13 |
|
---|
14 | c = zeros(size(x));
|
---|
15 | for b_iter = 1:(length(b)-1)
|
---|
16 | c(x >= b(b_iter)) = b_iter;
|
---|
17 | end
|
---|
Note: See
TracBrowser
for help on using the repository browser.