Problem with generating random numbers from a 2D distribution
Ältere Kommentare anzeigen
I used the following function
to generate random numbers, but i get wrong results. I wonder if i can use this function, if my distribution function(with dependent variables) is in this form:
where
theta = linspace(0, 2*pi, 10);
phi = linspace(0, pi, 10);
After posting the question: I think this function generates random numbers under the assumption that the variables of the 2D function is independent.
Antworten (1)
David Hill
am 6 Feb. 2022
Why not something like this? I might not be understanding you.
r=randi(10,1,2);
f(theta(r(1)),phi(r(2)));
1 Kommentar
Msimon q
am 6 Feb. 2022
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!