Sideway
output.to from Sideway
Draft for Information Only

Content

  MatLab: Frequently Used Codes
   Simple Line Geometry of Cyclic Points
    dwlingeom
    Example

MatLab: Frequently Used Codes

Major Reference Source: MatLab Verson 7.0

MatLab Package is designed for presentations, and therefore all data stored in arrays can be presented graphically.

Simple Line Geometry of Cyclic Points

Points are equally spaced in the form of a circle can be used to plot some simple line geometry by joining data points with lines.

dwlingeom

Code:

function varargout=dwlingeom(varargin)
%dwlingeom plots 2D line polygon
%
% dwlingeom
% to plot a 100-sided line polygon with circumcircle centre at [0,0] and radius of circumcircle equals to 1.
%
% varargout: ([],[a],[b],[c])
%
% varargint: ([a],[b],[c],[d])
%
% dwlingeom(n)
% for n=1, one single point is plotted at y equals to 0 and x equals to 0 plus offset radius 1 based on circumcircle centre at [0,0].
% for n=2, a line is plotted parallel to x-axis at y equals to 0 and x equals to 0 plus offset radius 1 based on circumcircle centre at [0,0].
% for n>=3, a line polygon of n sides is plotted.
% to plot a n-sided line polygon with circumcircle centre at [0,0] and radius of circumcircle equals to 1.
%
% dwlingeom(n,r)
% to plot a n-sided line polygon with circumcircle centre at [0,0] and radius of circumcircle equals to r.
%
% dwlingeom(n,r,x)
% to plot a n-sided line polygon with circumcircle centre at [x,0] and radius of circumcircle equals to r.
%
% dwlingeom(n,r,x,y)
% to plot a n-sided line polygon with circumcircle centre at [x,y] and radius of circumcircle equals to r.
%
% ---------
% Copyright (c) 2014, All Right Reserved, http://sideway.hk/
% LastChanged:20/06/2014
% version:000.00001 created 20/06/2014 from sideway.hk
%
%
if nargin==0
n=100;r=1;x=0;y=0;
elseif nargin==1
n=varargin{1};r=1;x=0;y=0;
elseif nargin==2
n=varargin{1};r=varargin{2};x=0;y=0;
elseif nargin==3
n=varargin{1};r=varargin{2};x=varargin{3};y=0;
elseif nargin==4
n=varargin{1};r=varargin{2};x=varargin{3};y=varargin{4};
else
error('in argument more than four');
end
[a,b]=dwcirspace(n,r,x,y);
if nargout==0
plot(a,b);
elseif nargout==1
ha=plot(a,b);
varargout{1}=ha;
elseif nargout==2
ha=plot(a,b);
varargout{1}=ha;
varargout{2}=[a,b];
elseif nargout==3
ha=plot(a,b);
varargout{1}=ha;
varargout{2}=a;
varargout{3}=b;
else
error('out argument more than three');
end

Example

  • Use function dwlingeom with default value to generate a line 100-sided polygon with circumcircle centre at [0,0] and radius of circumcircle equals to 1.

    Example:

     IMAGE...
     IMAGE...  

  • Use function dwlingeom with n=5 to generate a line regular pentagon with circumcircle centre at [0,0] and radius of circumcircle equals to 1.

    Example:

     IMAGE...  IMAGE...  

  • Use function dwlingeom with n=3 to generate a line equilateral triangle with circumcircle centre at [0,0] and radius of circumcircle equals to 5.

    Example:

     IMAGE...  IMAGE...  

  • Use function dwlingeom with n=2 to generate a line with circumcircle centre at [0,0] and radius of circumcircle equals to 5, i.e. a line from [5,0] to [-5,0].

    Example:

     IMAGE...  IMAGE...  

  • Use function dwlingeom with n=1 to plot a point at circle centre [4,5] with circle radius r equal to 2, i.e. a point at [6,5].

    Example:

     IMAGE...  IMAGE...  

  •  

 

©sideway

ID: 140600011 Last Updated: 6/20/2014 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019