Matlab Database > GUIs, Graphics & Visualization > Draw Angle of Line

Matlab File(s)

Title: Draw Angle of Line
Author: M2-TUM
E-Mail: matlabdb-AT-ma.tum.de
Institution: TU Munich
Description: This function plots an arc between the line and the specified reference axis indicating the angle of the line w.r.t the reference axis.

Color, reference axis and radius of the arc can be defined by the user.

  • Example 1:
       x1 = [15 10]; y1 = [15 10]; 
       line(x1,y1,'LineWidth',2), hold on
       drawangle(x1,y1),grid, hold off
    
  • Example 2:
       x1 = [15 5 5 15]; y1 = [15 15 5 5];
       ref_axis = ['x','y']; xc = 10; yc = 10;
       col = ['g' 'r' 'c' 'm' 'y' 'k']; colcount = 1;
       for j = 1:length(ref_axis)
         for i = 1:length(x1)
           line([x1(i) xc],[y1(i) yc],'LineWidth',2),hold on
           drawangle([x1(i) xc],[y1(i) yc],col(colcount),ref_axis(j),1)
           colcount = colcount +1;
           if colcount > length(col), colcount = 1; end
         end
       end, hold off, grid
    

This file was written by Faisal Baig, with financial support by the Self-Study Online project of the University of Stuttgart.

Keywords: angle, arc, line
File Name: drawangle.m
File Size: 5 KB
File Version: 1.0
Matlab Version: 6.5 (R13)
Date: 2004-03-15
Downloads: 4228
Download File

Upload your own files today! Click here for more information.