Question: Using Matlab, How do I plot the random density function of a random variable and the output of its function in histogram format? I have

Using Matlab, How do I plot the random density function of a random variable and the output of its function in histogram format? I have this code:

%Initializations iterations = 10000; %number of trials 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

I am supposed to plot the probability desnity function of both r and theta. How do I plot this using Matlab in order to normally distrubte the answers while using a histogram format? With a normal plot I can get the PDF but as a histogram it is not normally distributed.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!