How to graph cdf?

9 ビュー (過去 30 日間)
Estela
Estela 2022 年 12 月 15 日
回答済み: William Rose 2022 年 12 月 15 日
Here's the rpoblem: The default random number generators for most programming languages provides a uniform distribution on the interval [0,1]. What is the probability that a MATLAB random number generator yields (a) X=0.25
>> F = cdf('Uniform',0.25,0,1)
how could I graph this with x n of trials and probability?
  1 件のコメント
Fifteen12
Fifteen12 2022 年 12 月 15 日
This looks like homework, but even if it's not, you might want to read the following. It will help when trying to get help with questions like this! https://www.mathworks.com/matlabcentral/answers/8626-how-do-i-get-help-on-homework-questions-on-matlab-answers
Otherwise, the question doesn't quite make sense. If you graphed "the probability that" rng generates "X=0.25" then your graph would just be a dot. Maybe rephrase the question, and add what you've already tried?

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

回答 (1 件)

William Rose
William Rose 2022 年 12 月 15 日
I agree with the comments of @John Morris. The probability that a random number generator for a continuous distribution (such as the uniform distribution) produces one pre-specified value is zero. That is because one point is an infinitesimally small part of a line segment. Example:
X=rand(1e6,1); %a million randoms on U[0,1)
disp(length(X(X==.25))) %display the number of X=.25's found
0
None found in a million tries.
Maybe that is the point of the question. As @John Morris notes, there's nothing interesting to plot.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by