clear, clc% the arc coordinates
a=2:0.001:3;b=sqrt((16-a.^2));plot(a,b,'k')axis equal grid onhold 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
% rotatinga22=a1.*cosd(rot_angle)-b1.*sind(rot_angle);b22=a1.*sind(rot_angle)+b1.*cosd(rot_angle);% translatinga2=a22+x_origin;b2=b22+y_origin;plot(a2,b2,'--g')
MATLAB: 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 ????!!!!
MATLAB
Best Answer