- You never use a11,b11 anywhere.
- After rotating back, you perform a translation by x_origin, y_origin. In other words, it did come back to its original position, but then you shifted it.
can any body find the mistake here? I am rotating the coordinates of the arc and then bringing it to its original position. but it is not coming back to its original position ????!!!!
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clear, clc
% the arc coordinates
a=2:0.001:3;
b=sqrt((16-a.^2));
plot(a,b,'k')
axis equal
grid on
hold on
% the new coordinate axis origin and rotating angle from the first
% coordinate
x_origin= 1;
y_origin= 1;
rot_angle= -45;
% 1- calculating the coordinate of the arc according to the new coordinates
% translating
a11=a-x_origin;
b11=b-y_origin;
% rotating
a1=a.*cosd(-1*rot_angle)-b.*sind(-1*rot_angle);
b1=a.*sind(-1*rot_angle)+b.*cosd(-1*rot_angle);
plot(a1,b1,'r')
% 2- re_transformating the axis to the first one
% rotating
a22=a1.*cosd(rot_angle)-b1.*sind(rot_angle);
b22=a1.*sind(rot_angle)+b1.*cosd(rot_angle);
% translating
a2=a22+x_origin;
b2=b22+y_origin;
plot(a2,b2,'--g')
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Polar Plots 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!