How can I rotate an ellipse randomly
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
This is what I have written so far
t = linspace(0,2*pi)
x = randn + randn*cos(t)
rng('shuffle');
y = randn + randn*sin(t);
plot(x,y)
I want to create random rotation for this ellipse each time I plot it while keeping this same code I have written so far.
2 commentaires
Walter Roberson
le 3 Mar 2021
Well, that would be possible, but it would be significantly easier if you could modify your existing code to something like
t = linspace(0,2*pi)
xc = randn();
x = xc + randn*cos(t)
rng('shuffle');
yc = randn();
y = yc + randn*sin(t);
plot(x,y)
axis equal
If you do that then it becomes easier to rotate around its center, which would be at the known point (xc, yc). But if you insist that the existing code must be kept as-is, then it becomes necessary to estimate xc and yc
Réponses (1)
Voir également
Catégories
En savoir plus sur 3-D Scene Control dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!