Octave graphic add-on, Octplot



česky

2.1 Square, rectangle, triangle



Function file: square(m,n,a,fmt)


This function plots a square, defined by:
  • 1 square - left bottom corner in [m,n] and length of side "a"; all values are scalars
  • 1 square - left bottom corner (LBC) and right upper corner (RUC) in [m,n]; all values are scalars
  • n-squares- LBC and RUC in [m,n]; either LDR is vector 1x2 and RUC is matrix Nx2 or LDR is matrix and Nx2 and RUC is vector 1x2 or LDC and RUC are matrixes Nx2

Parameters m,n described corners of the square in axes x,y.
Parameter fmt describe format of the square lines. You can change format of lines (color and style) and format of points, see 1.2 Basic graphs I - plot.

Example:
square([1 2;-1 2;2 4],[1 2;2 5;4 6]);





Function file: rectangle(m,n,a,b,fmt)


This function draws a rectangle, defined by:
  • 1 rectangle - LDC in [m,n] and length of side "a" and "b"; all values are scalars
  • 1 rectangle - LDC and RUC in [m,n]; all values are scalars
  • n-rectangles - LDC and RUC in [m,n]; either LDC is vector 1x2 and RUC is matrix Nx2 or LDC is matrix Nx2 and RUC is vector 1x2 or LDC and RUC are matrixes Nx2

Parameters m,n describe corners of the rectangle in axes x,y.
Parameter fmt describe format of the rectangle lines. You can change format of lines (color and style) and format of points.

Example:
rectangle([1 3;6 4;2 3],[0 3;2 7;1 5]);



download m-file



Function file: triangle(m,n,type,param_a,param_b,param_c,fmt)


This function plots a triangle, which can be defined by 2 ways:
  1. 3 points in axes x,y
    • 1 triangle - corner points A,B,C in [m,n]; m,n are scalars, fmt is optional
    • n-triangles - corner points A,B,C in [m,n]; either parameter m is vector 1x3 and n is matrix Nx3 ro m is matrix Nx3 and n is vector 1x3 or m and n are matrixes Nx3
  2. sides and angles
    • side,side,side - triangle defined by sides "a","b","c", type = "sss"
    • angle,side,side - triangle defined by angle "alpha" and sides "b","c", type = "ass"
    • side,angle,side - triangle defined by angle "beta" and sides "a","c", type = "sas"
    • side,side,angle - triangle defined by angle "gama" and sides "a","b" type = "ssa"

Parameters m,n describe corners of the triangle in axes x,y.
Parameter param_a is either length of side "a" or angle "alpha" (according to type), similar param_b(length of side "b" or angle "beta") and param_c(length of side "c" or angle "gama").
Parameter fmt describe format of the triangle lines. You can change format of lines (color and style) and format of points.

Example:
triangle([1,2,5;-1 -3.4 -5.2],[1,3,2;2,4.2,1],"gv-");




triangle(1,2,"ssa",2,3,20,"md-");



download m-file





<<< 2. New function for Octplot 2.2 Tetragon, n-square, circle >>>

© 2008 David Prokop