# How to rotate points on 2D coordinate systems

324 views (last 30 days)
Rightia Rollmann on 5 Feb 2017
Commented: George Abrahams on 12 Feb 2024
I have some points on a 2D Cartesian coordinate system. I want to rotate all these points 90 degrees counterclockwise. What is the best solution? (When I work with 3D coordinates, I use “view” to change the view direction, but apparently, it doesn’t work with 2D coordinates)
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Accepted Answer

John Chilleri on 6 Feb 2017
Hello,
You can rotate your points with a rotation matrix:
Here's a simple implementation,
% Create rotation matrix
theta = 90; % to rotate 90 counterclockwise
R = [cosd(theta) -sind(theta); sind(theta) cosd(theta)];
% Rotate your point(s)
point = [3 5]'; % arbitrarily selected
rotpoint = R*point;
The rotpoint is the 90 degree counterclockwise rotated version of your original point.
Hope this helps!
##### 4 CommentsShow 2 older commentsHide 2 older comments
Ria on 12 Feb 2024
Hello, if you needed the rotation clockwise, could you just reverse each sign of cosd and sind?
George Abrahams on 12 Feb 2024
@Ria You have two options. First option, set theta, the angle of rotation, to -90. Second option, the inverse of a rotation matrix is its transpose, , so transpose the matrix. In MATLAB this is typically achieved with the .' syntax.
R = [cosd(-90) -sind(-90); sind(-90) cosd(-90)]
R = 2×2
0 1 -1 0
R = [cosd(90) -sind(90); sind(90) cosd(90)].'
R = 2×2
0 1 -1 0

Sign in to comment.

### More Answers (3)

Amit on 29 Mar 2023
Write and execute a MATLAB program for geometric modeling of a parametric circle with center at any point {xc,yc}, radius R and lying in the X-Y plane. Test your program with R=40 mm and center at both the origin and at {10,10} for estimating the point and tangent vector at any given parameter value 0<=u<=1.
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

Amit on 29 Mar 2023
Write and execute a MATLAB program for geometric modeling of a parametric circle with center at any point {xc,yc}, radius R and lying in the X-Y plane. Test your program with R=40 mm and center at both the origin and at {10,10} for estimating the point and tangent vector at any given parameter value 0<=u<=1.
Write the Matlab code for both the original parametric equation and computationally efficient parametric equation. Compare the computational times.
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

Amit on 29 Mar 2023
a) Write and execute a MATLAB program to plot a planar parametric curve whose x- and y- axis modeled using cubic polynomial of the form: X(u) =A*u^3+B*u+C Y(u) =E*u^3+F* u^2+G Where 0 ≤ u ≤ 1 is the parameter, and A, B, C, E, F, G are the polynomial coefficients. Your program should work for any user supplied input of these polynomial coefficients.
b) Write Matlab program to generate and plot a the Hermite cubic curve for any set of two control points and two tangent vectors. Validate your code with sample data given below: P0 = [1, 1], P’0 = [0.6, 0.8], P1= [8, 2] and P’1 = [-0.4472, -0.8944].
Also include in the program the facility of putting point at the specified u-value and an arrow for the tangent vector at that point.
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Categories

Find more on z-transforms in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!