- If you want to generate random numbers from a custom CDF, one simple procedure is to generate uniform(0,1) random numbers with u=rand, and then find the X value whose CDF equals u within your custom CDF.
- Can you know the type of distribution of your custom CDF? Well, not necessarily, no, because your custom CDF does not have to match that of any known distribution. You can try different known distributions and see how well their CDFs match yours, but there might not be any with a good match.
- Fitting the CDF to a suitable PDF...I'm not sure exactly what you have in mind here--maybe this is the same as #2. But if you have the custom CDF then you can simply compute the corresponding custom PDF by numerical differentiation. But that won't help you generate random numbers--for that purpose, the CDF format is more convenient (see #1).

# Forming a CDF by adding different types of PDF and generating random number

9 views (last 30 days)

Show older comments

Hello,

I have read certain threads on generating random numbers and developing distributions functions in MATLAB. I could not get the answer to my doubt and also guess I am not aware of all the functions and capabilitites of MATLAB still.

I am trying the develop a CDF from multiple PDFs (of different variables). I am able to do that. But the next part- generating random number from this custom CDF is very tricky and creating nuisance. Can you please tell me- if I can know the type of distribution of this custom CDF (without using Distribution Fitter toolbox,if possible- as this is in the middle of the program, running multiple times)??

I want to fit this CDF to suitable PDF and then generate the random number from that PDF. Please guide.

(Please let me know if I am missing on something.)

Thank you in advance for your time.

##### 0 Comments

### Accepted Answer

Jeff Miller
on 4 Sep 2021

It seems like there are several different questions here.

Hope that helps,

##### 14 Comments

### More Answers (0)

### See Also

### Community Treasure Hunt

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

Start Hunting!