Question: I posted this question, but it cut off my code. Thank you for any assistance. I am trying to write MATLAB code that uses rejection

I posted this question, but it cut off my code. Thank you for any assistance. I am trying to write MATLAB code that "uses rejection technique to generate a Gaussian distribution, assume zero mean and variance unity" then I wish to plot a histogram of the distribution and the Gaussian pdf function on the same plot to compare. I should not have bars from the histogram far out of the gaussian plot constraint, but I keep getting them. There should be very very little or no green above red line. I do not know what could be wrong with my rejection method code. Can you please tell me what is wrong with my code for rejection technique to generate gaussian, and can you please show me how to fix it in MATLAB?
Please, please, please test it out by running on MATLAB before you answer. I have attached code (would not let me put in question) and figure.
 I posted this question, but it cut off my code. Thank

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!