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!