Probability density function for binary data
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
I have data for the index of each point: 0 for the point outside particle, 1 for the points inside particle.
How to calculate calculate the PDF for this case? If you know that my domaine points is in [200 67].
And I want to calculate the PDF in a fixed x-point for example 80.
採用された回答
Image Analyst
2021 年 10 月 2 日
Not sure what the PDF means in this context. You can compute the chance the particle will be a 0 or a 1. This would give a PDF with only two values on the x axis.
p(1) = sum(data == 0) / numel(data);
p(2) = sum(data == 1) / numel(data);
Is that what you want? Or do you have (x,y) locations for each point and want some sort of 2-D probability that the "1" will land at some location or radius?
12 件のコメント
Tesla
2021 年 10 月 4 日
Thank you for the answer.
I mean by PDF the Probability density function.
Attached an example of my data. The data for the whole domain (67X335).
And I want a 2-D PDF that the "1" will land at some location, for me I am interested in a fixed x, for example in X=50. And See how the PDF is changing along Y axis.
The attached data is for 1 iterations, and I have around 1000 iterations. You can see the picture. This data is already done by Matlab.
So the PDF has to be the average for the whole data iterations.
Image Analyst
2021 年 10 月 4 日
The workbook contains just one of those 67x335 matrices. The values are either -1, 0, or 1. Explain what the rows and columns represent.
Tesla
2021 年 10 月 5 日
The workbook is just for 1 iteration, and its 67x335 matrices which meand 67 point in Y-axis and 335 point in X-axis.
When the values ares 1 means we are in inside the cell, and 0 means outside the cell. for -1 its means outside the domain of my calculations.
Tesla
2021 年 10 月 7 日
Any clue?
Image Analyst
2021 年 10 月 7 日
編集済み: Image Analyst
2021 年 10 月 7 日
So the row number is y and the column index is x? So I can get the one's (x,y) coordinates by doing
[y, x] = find(theMatrix);
Correct? If so, why don't you just add the matrix at each iteration to a master, growing, cumulative matrix and then divide that matrix by the number of iterations to get the pdf?
Tesla
2021 年 10 月 7 日
Yes correct. How can I do that?
Image Analyst
2021 年 10 月 7 日
See the FAQ for how to read in different files
Tesla
2021 年 10 月 8 日
Thank you,
But indeed my data are already stored on matlab variable, you can see the screenshot.
I am just worring how to use your suggestion to calculate the pdf.
If ca is your cell array:
numCells = length(ca);
sumArray = zeros(67, 335);
for k = 1 : numCells
thisCell = ca{k}; % A single 67x335 matrix.
sumArray = sumArray + thisCell;
end
meanArray = sumArray / numCells;
Does that do what you want?
Tesla
2021 年 10 月 8 日
The code is giving the total pdf for the whole domain. I want the pdf in a specified x-point.
For example in x=30. You see?
Why isn't it just
% Get probability for various y values along the x=30 line.
pdf30 = meanArray(:, 30);
Tesla
2021 年 10 月 8 日
Thank you very much, it works!
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Repeated Measures and MANOVA についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
