# Calculating statistical PDF and percentiles over matrices

5 ビュー (過去 30 日間)
George 2015 年 1 月 27 日
コメント済み: George 2015 年 2 月 10 日
Hello
I was wondering if there is a ways to calculate and represent the statistical properties of a matrix and then present it in a countour/image/pcolor way.
Assuming we have a matrix, and the percentile values are to be found for every point of the matrix, the prctile allows to calculate either or columns or rows only. Same goes for the PDF fitting.
for example:
x=magic(100); % matrix of 100x100
prctile(x,,1); % calculates the percentiles for column x
so i get a 1x100 in this case
prctile(x,,2); % calculates the percentiles for rows x
the result is 100x1 vector
What I want to though is to have the matrix constant or/and fit PDF or percentile for every point
Is there a way to achieve this?
Thank you
p.s The process involves a set of matrices with exact same dimensions, but I try to keep the question simple so as other people may find it useful.

サインインしてコメントする。

### 回答 (2 件)

Alessandro Masullo 2015 年 1 月 27 日
You can replace x with x(:) in prctile. The whole matrix will be squeezed in a single vector what will be evaluated just once.
##### 1 件のコメント表示非表示 なし
George 2015 年 1 月 27 日
I tried that, but my target is to preserve the matrix so as to use one of the contourf, image etc. so as to plot it as a table showing the difference in statistical parameters as values per points

サインインしてコメントする。

Tom Lane 2015 年 2 月 9 日
I'm not sure this is what you want, but:
a = peaks % 49x49 matrix
b = bsxfun(@plus,a,5*randn(49,49,1000)); % 49x49x1000 matrix
c = prctile(b,95,3); % 49x49 matrix of 95th percentiles
surf(c)
##### 1 件のコメント表示非表示 なし
George 2015 年 2 月 10 日
Hello
I have a problem in the PDF calculations, for other statistical representation I have introduced a loop in this form, although when I try to apply the same in a normPDF I cannot get an overall calculations of the parameters of the PDF for each and every point of my mesh
fns=fields(x);
[sz1 sz2]=size(x.(fns{1}));
c=zeros(sz1,sz2,length(fns),'single');
for n=1:length(fns)
fn=char(fns(n));
c(1:sz1,1:sz2,n)=x.(fn);
end
x1 = prctile(c,,3);

サインインしてコメントする。

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!