Generating random angles between interval

7 次查看(过去 30 天)
How would I generate three random angles between (-pi to pi)?
ex) q= [theta1 theta2 theta3], all theta are random numbers between -pi to pi

回答(1 个)

Star Strider
Star Strider 2022-11-2
Try something like this —
random_angles3 = rand(1,3)*2*pi - pi
random_angles3 = 1×3
-0.5707 1.4107 -2.3760
random_angles1000 = rand(1,1000)*2*pi - pi;
figure
histogram(random_angles1000, 25)
.

类别

Help CenterFile Exchange 中查找有关 Random Number Generation 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by