From 8c3d7ffe059d6df838a75cd5ba0b203a407315c1 Mon Sep 17 00:00:00 2001 From: Gabri6 Date: Fri, 3 Feb 2023 11:42:04 +0100 Subject: [PATCH] updated the creation of the rotation matrix, and corrected a mistake --- create2DRotationMatrix.m | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/create2DRotationMatrix.m b/create2DRotationMatrix.m index e11c6fd..13c4681 100644 --- a/create2DRotationMatrix.m +++ b/create2DRotationMatrix.m @@ -1,27 +1,3 @@ -## Copyright (C) 2023 gabri -## -## This program is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program. If not, see . - -## -*- texinfo -*- -## @deftypefn {} {@var{retval} =} create2DRotationMatrix (@var{input1}, @var{input2}) -## -## @seealso{} -## @end deftypefn - -## Author: gabri -## Created: 2023-02-03 - function myrotationmatrix = create2DRotationMatrix (z) %%%%%%%%%%%%%%%%% %the function create2DRotationMatrix takes an agle in degrees as a argument, @@ -38,13 +14,13 @@ function myrotationmatrix = create2DRotationMatrix (z) %Last Modified: 03/02/2023 11:06:51 %%%%%%%%%%%%%%%%%% z = z*(pi/180); - myrotationmatrix = [cos(z),sin(z);(-sin(z)),cos(z)] + myrotationmatrix = round([cos(z),sin(z);(-sin(z)),cos(z)] .* 10000) ./ 10000; %test angle = 90; expectedrotationmatrix = [0 1;-1 0]; angle = angle*(pi/180); - testrotationmatrix = [cos(angle),sin(angle);(-sin(angle)),cos(angle)] + testrotationmatrix = round([cos(angle),sin(angle);(-sin(angle)),cos(angle)] .* 10000) ./10000 if (abs(abs(expectedrotationmatrix .- testrotationmatrix)) < 1e-10) disp("Test #1 Passed") else