## Copyright (C) 2018 rolf.becker ## ## 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 2 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 Octave; see the file COPYING. If not, see ## . ## turn ## Author: rolf.becker ## Created: 2018-11-12 function [ ret ] = turn () scl = 0.4; lw = 3; sty = 2; n = 16; Z = [0 0]'; P1 = [2 0]'; P2 = [0 1]'; M = 2*[1 1]'; phi=2*pi/n; R=( [cos(phi) -sin(phi) ; sin(phi) cos(phi)] ); for i=0:n arrow(Z,M,scl,sty,lw) axis([-5 5 -5 5]) axis square hold on arrow(M,M+P1,scl,sty,lw) arrow(M,M+P2,scl,sty,lw) hold off grid on set(gca,"fontsize",24,"xtick",-5:5,"ytick",-5:5) % title("Rotating Vectors"); xlabel("x"); ylabel("y"); M=R*M; P1=R*P1; P2=R*P2; sleep(0.1); endfor endfunction