User Tools

Site Tools


supp:octave:contrib:arrow:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
supp:octave:contrib:arrow:start [2016/04/10 19:55] – [Arrow] adminsupp:octave:contrib:arrow:start [2018/11/12 16:13] (current) – [turn.m] admin
Line 1: Line 1:
-====== Arrow Vector ======+====== Rotate Vectors and Draw Arrows ======
  
  
  
 ===== arrow.m ===== ===== arrow.m =====
 +
 +Draw vector arrow.
  
 <file octave arrow.m> <file octave arrow.m>
Line 130: Line 132:
  
 </file> </file>
 +
 +
 +===== turn.m =====
 +
 +{{:supp:octave:contrib:arrow:rotate_vectors.png?nolink&400|}}
 +
 +<file octave turn.m>
 +## 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
 +## <http://www.gnu.org/licenses/>.
 +
 +## turn
 +
 +## Author: rolf.becker <rolf.becker@hsrw.eu>
 +## 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
 +</file>
 +
 +
supp/octave/contrib/arrow/start.1460318157.txt.gz · Last modified: 2016/04/10 19:55 by admin