How can I rotate an ellipse randomly
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
Walter Roberson
2021 年 3 月 3 日
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
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で 3-D Scene Control についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!