Beispiel #1
0
def draw_contour():
    import numpy

    x, y = numpy.mgrid[0:7.5:0.05, 0:7.5:0.05]
    c = 0 * x
    s, t = x.shape
    for i in range(s):
        for j in range(t):
            xx, yy = x[i, j], y[i, j]
            c[i, j] = CostFunction([xx, yy])

    sam.putarray('X', x)
    sam.putarray('Y', y)
    sam.putarray('C', c)

    sam.verbose()
    sam.eval("[c,h]=contourf(X,Y,log(C*20+1)+2,100);set(h,'EdgeColor','none')")
    sam.eval("title('Zimmermann''s Corner. Min at 7,2')")
    sam.eval('hold on')
Beispiel #2
0
def draw_contour():
    import numpy

    x, y = numpy.mgrid[0:2.1:0.05, 0:2.1:0.05]
    c = 0 * x
    s, t = x.shape
    for i in range(s):
        for j in range(t):
            xx, yy = x[i, j], y[i, j]
            c[i, j] = Corana2([xx, yy])

    sam.putarray('X', x)
    sam.putarray('Y', y)
    sam.putarray('C', c)

    sam.verbose()
    sam.eval("[c,h]=contourf(X,Y,C,100);set(h,'EdgeColor','none')")
    #sam.eval("[c,h]=contourf(X,Y,log(C*20+1)+2,100);set(h,'EdgeColor','none')")
    sam.eval("title('Corana''s Parabola in 2D. Min at 0,0')")
    sam.eval('hold on')
Beispiel #3
0
def draw_contour():
    import numpy

    x, y = numpy.mgrid[0:2.1:0.02, 0:2.1:0.02]
    c = 0 * x
    s, t = x.shape
    for i in range(s):
        for j in range(t):
            xx, yy = x[i, j], y[i, j]
            c[i, j] = rosen([xx, yy])

    sam.putarray('X', x)
    sam.putarray('Y', y)
    sam.putarray('C', c)

    sam.verbose()
    #sam.eval("[c,h]=contourf(X,Y,C,60);set(h,'EdgeColor','none')")
    sam.eval("[c,h]=contourf(X,Y,log(C*20+1)+2,60);set(h,'EdgeColor','none')")
    sam.eval("title('Rosenbrock''s function in 2D. Min at 1,1')")
    sam.eval('hold on')
Beispiel #4
0
def draw_contour():
    import numpy

    x, y = numpy.mgrid[0:7.5:0.05,0:7.5:0.05]
    c = 0*x
    s,t = x.shape
    for i in range(s):
       for j in range(t):
          xx,yy = x[i,j], y[i,j]
          c[i,j] = CostFunction([xx,yy])


    sam.putarray('X',x)
    sam.putarray('Y',y)
    sam.putarray('C',c)

    sam.verbose()    
    sam.eval("[c,h]=contourf(X,Y,log(C*20+1)+2,100);set(h,'EdgeColor','none')")
    sam.eval("title('Zimmermann''s Corner. Min at 7,2')")
    sam.eval('hold on')
Beispiel #5
0
def draw_contour():
    import numpy

    x, y = numpy.mgrid[0:2.1:0.05,0:2.1:0.05]
    c = 0*x
    s,t = x.shape
    for i in range(s):
       for j in range(t):
          xx,yy = x[i,j], y[i,j]
          c[i,j] = Corana2([xx,yy])


    sam.putarray('X',x)
    sam.putarray('Y',y)
    sam.putarray('C',c)

    sam.verbose()    
    sam.eval("[c,h]=contourf(X,Y,C,100);set(h,'EdgeColor','none')")
    #sam.eval("[c,h]=contourf(X,Y,log(C*20+1)+2,100);set(h,'EdgeColor','none')")
    sam.eval("title('Corana''s Parabola in 2D. Min at 0,0')")
    sam.eval('hold on')
Beispiel #6
0
def draw_contour():
    import numpy

    x, y = numpy.mgrid[0:2.1:0.02,0:2.1:0.02]
    c = 0*x
    s,t = x.shape
    for i in range(s):
       for j in range(t):
          xx,yy = x[i,j], y[i,j]
          c[i,j] = rosen([xx,yy])


    sam.putarray('X',x)
    sam.putarray('Y',y)
    sam.putarray('C',c)

    sam.verbose()    
    #sam.eval("[c,h]=contourf(X,Y,C,60);set(h,'EdgeColor','none')")
    sam.eval("[c,h]=contourf(X,Y,log(C*20+1)+2,60);set(h,'EdgeColor','none')")
    sam.eval("title('Rosenbrock''s function in 2D. Min at 1,1')")
    sam.eval('hold on')
Beispiel #7
0
def draw_contour_xy():
    import numpy
    x, y = mgrid[-40:40:0.5, -40:40:0.5]
    x = x0 + x
    y = y0 + y
    s, t = x.shape
    c = 0 * x
    s, t = x.shape
    for i in range(s):
        for j in range(t):
            xx, yy = x[i, j], y[i, j]
            c[i, j] = cost_function([xx, yy, z0, v0])

    sam.putarray('X', x)
    sam.putarray('Y', y)
    sam.putarray('C', c)

    sam.verbose()
    sam.eval("[c,h]=contourf(X,Y,C,100);set(h,'EdgeColor','none')")
    sam.eval("title('Mogi Fitting')")
    sam.eval('hold on')
Beispiel #8
0
def draw_contour_xy():
    import numpy
    x, y = mgrid[-40:40:0.5, -40:40:0.5]
    x = x0 + x
    y = y0 + y
    s,t = x.shape
    c = 0*x
    s,t = x.shape
    for i in range(s):
       for j in range(t):
          xx,yy = x[i,j], y[i,j]
          c[i,j] = cost_function([xx,yy, z0, v0])


    sam.putarray('X',x)
    sam.putarray('Y',y)
    sam.putarray('C',c)

    sam.verbose()    
    sam.eval("[c,h]=contourf(X,Y,C,100);set(h,'EdgeColor','none')")
    sam.eval("title('Mogi Fitting')")
    sam.eval('hold on')