フィルターのクリア

why cant i rotate the 2nd line at the X axis it takes reference as point 0,0 and rotates at 45 degree angle i want to rotate the line at same axis

1 回表示 (過去 30 日間)
qq11eeq.PNG
  3 件のコメント
Prakash Choudhary
Prakash Choudhary 2019 年 4 月 6 日
close all;
clc;
clear all;
x0= [0 0];
y0= [-85 85];
x1 = [820 820 ];
y1 = [ -85 85 ];
hold on
plot (x1,y1);
plot (x0,y0);
grid on
angle=45;
angle_rad=((angle*2.*pi)./360);
[THETA,R] = cart2pol(x0,y0);
THETA=THETA+angle_rad; %Add a_rad to theta
[x0r,y0r] = pol2cart(THETA,R);
plot(x0r,y0r);
axis equal; %Rotated
angle=45;
angle_rad=((angle*2.*pi)./360);
[THETA,X] = cart2pol(x1,y1);%Convert to polar coordinates
THETA=THETA+angle_rad; %Add a_rad to theta
[x1r,y1r] = pol2cart(THETA,X); %Convert back to Cartesian coordinates
plot(x1r,y1r);
grid on
hold off
axis equal; %Rotated
Prakash Choudhary
Prakash Choudhary 2019 年 4 月 6 日
I am Just a biggner so i creat the code with code with theta.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2019 年 4 月 6 日
It is rotating. Look at the top of your plot.
The way to rotate relative to a point is to subtract the coordinates of the point to rotate around, do the rotation, then add the coordinates of the point to rotate around back in. If you want ot rotate around (800,0) then cart2pol(x1-800,y1) and plot(x1r+800,y1r)

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange3-D Scene Control についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by