How to normalize random variables and the function of the random variable using a histogram?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a constantly changing random variable that contributes to producing an output. Here is the code:
r = []; %set vector r to be zero
v = 10; %set muzzle velocity to 10 m/s
g = 9.81; %set gravity to 9.81 m/s^2
for i=1:1:iterations
theta = (pi/2)*rand; %creates RV theta to be between 0 and pi/2
r(i) = 2*sin(theta)*cos(theta)*(v^2)/g;
RV_theta(i)=theta; %stores values of RV into variable
end
Now I know how to plot the normalized function and RV as a normal plot but I want the plot to be a histogram. How can I do this for both the RV theta and the output r to get the probability density function?
댓글 수: 0
답변 (1개)
Sonam Gupta
2017년 11월 6일
To plot a normalized histogram, you may find following file exchange submission helpful:
Also, the following MATLAB Answer talks about normalizing a histogram in MATLAB:
Hope this helps.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!