summaryrefslogtreecommitdiffstats
path: root/scilab_doc/neldermead/scripts/initialsimplex_regular.sce
blob: ff9722143b024965ce700fd062dbb4014cc2ea25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2009 - Digiteo - Michael Baudin
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt

// Draw a regular simplex in 2D
n = 2
p  = (n - 1.0 + sqrt(n + 1))/(n * sqrt(2.0))
q = (sqrt(n + 1) - 1.0)/(n * sqrt(2.0))

x = zeros(4,1)
y = zeros(4,1)

// First point is (0,0)
// Second point is (p,q)
x(2) = p
y(2) = q
// Third point is (q,p)
x(3) = q
y(3) = p
// Fourth point is (0,0), just to make the loop in the simplex
// Now plot the simplex
plot(x,y)
f = gcf()
f.children.children.children.thickness = 4
f.children.children.children.mark_style = 9
f.children.children.children.mark_foreground = 3
f.children.children.children.mark_size = 10