Sideway
output.to from Sideway
Draft for Information Only

Content

  MatLab: Frequently Used Codes
   Simple Line Star Geometry of Cyclic Points
    dwlinstar
    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 Star 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.

dwlinstar

Code:

function varargout=dwlinstar(varargin)
%dwlinstar plots 2D line star geometry
% (same as dwlingeom when starriness equals to 1)
% (side n must be greater or equal to 5)
% (side n/stairiness r must be greater than 2)
%
% varargout: ([a],[b],[c])
%
% varargint: ([a],[b],[c],[d],[e])
%
% dwlingeom
% to plot a 5-sided line star polygon with starriness equals to 2, circumcircle centre at [0,0] and radius of circumcircle equals to 1.
%
%
% dwlingeom(n)
% for n>=5, a line star polygon of n sides is plotted with starriness equals to 2, circumcircle centre at [0,0] and radius of circumcircle equals to 1.
% to plot a n-sided line star polygon with starriness equals to 2, circumcircle centre at [0,0] and radius of circumcircle equals to 1.
%
% dwlingeom(n,s)
% to plot a n-sided line star polygon with starriness equals to s, circumcircle centre at [0,0] and radius of circumcircle equals to 1.
%
% dwlingeom(n,s,r)
% to plot a n-sided line star polygon with starriness equals to s, circumcircle centre at [0,0] and radius of circumcircle equals to r.
%
% dwlingeom(n,s,r,x)
% to plot a n-sided line star polygon with starriness equals to s, circumcircle centre at [x,0] and radius of circumcircle equals to r.
%
% dwlingeom(n,s,r,x,y)
% to plot a n-sided line star polygon with starriness equals to s, circumcircle centre at [x,y] and radius of circumcircle equals to r.
%
% ---------
% Copyright (c) 2014, All Right Reserved, http://sideway.hk/
% LastChanged:21/06/2014
% version:000.00001 created 20/06/2014 from sideway.hk
%
%
if nargin==0
n=5;s=2;r=1;x=0;y=0;
elseif nargin==1
n=varargin{1};s=2;r=1;x=0;y=0;
elseif nargin==2
n=varargin{1};s=varargin{2};r=1;x=0;y=0;
elseif nargin==3
n=varargin{1};s=varargin{2};r=varargin{3};x=0;y=0;
elseif nargin==4
n=varargin{1};s=varargin{2};r=varargin{3};x=varargin{4};y=0;
elseif nargin==5
n=varargin{1};s=varargin{2};r=varargin{3};x=varargin{4};y=varargin{5};
else
error('in argument more than five');
end
if n<5
error('side must be greater or equal to 5');
end
if n/r<=2
error('side n/stairiness r must be greater than 2');
end
[a,b]=dwcirspace(n,r,x,y);con=gcd(n,s);
if con>1
i1=mod(s*(1:n/con+1)-(s-1),n);i1(i1==0)=n;
aa=[];bb=[];i1=mod(i1(1:n/con+1),n);i1(i1==0)=n;
for i2=0:con-1 for i2=0:con-1
i3=mod(i1+i2,n);i3(i3==0)=n;
aa=vertcat(aa,a(i3));bb=vertcat(bb,b(i3));vertcat(bb,b(i3));
end
a=aa';b=bb';
else
i1=mod(s*(1:(n+1))-(s-1),n);i1(i1==0)=n;a=a(i1);,b=b(i1);
end
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 dwlinstar with default value to generate a line 5-sided star polygon with starriness equals to 2, circumcircle centre at [0,0] and radius of circumcircle equals to 1.

    Example:

     IMAGE...
     IMAGE...  

  • Use function dwlinstar to generate a line 6-sided star polygon with side n equal to 6, starriness equals to 2, circumcircle centre at [1,4] and radius of circumcircle equals to 5.

    Example:

     IMAGE...  IMAGE...  

  • Use function dwlinstar to generate a line 7-sided star polygon with side n equal to 7, starriness equals to 3, circumcircle centre at [1,4] and radius of circumcircle equals to 5.

    Example:

     IMAGE...  IMAGE...  

  •  

 

©sideway

ID: 140600012 Last Updated: 6/21/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