フィルターのクリア

Why does the sum of the counts delivered by hist2 not equal the number of rows in x and y?

1 回表示 (過去 30 日間)
Here is the documentation Example for hist2:
events = 1000000;
x1 = sqrt(0.05)*randn(events,1)-0.5; x2 = sqrt(0.05)*randn(events,1)+0.5;
y1 = sqrt(0.05)*randn(events,1)+0.5; y2 = sqrt(0.05)*randn(events,1)-0.5;
x= [x1;x2]; y = [y1;y2];
For linearly spaced edges:
xedges = linspace(-1,1,64); yedges = linspace(-1,1,64);
histmat = hist2(x, y, xedges, yedges);
When I run the 6 lines of code above (not including the 'For...), I get a matrix in which the total number of counts is substantially less than the lengths of x & y (2000000)
sum(histmat(1:end))
ans =
1949700.00
  3 件のコメント
Charles Gallistel
Charles Gallistel 2019 年 12 月 12 日
I did not realize that it was not a part of MATLAB. I have just looked at the code for the one I am using and it gives no version information, nor copyright, etc. I will try others.
Charles Gallistel
Charles Gallistel 2019 年 12 月 12 日
Others are more specialized and poorly documented. I will have to create my own code.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by