sábado, 7 de marzo de 2015

SIGNOIDAL DECRECIENTE


from pylab import *
import matplotlib.pyplot as plt
import math




def plot_sigmoidaldecre(lista_de_x,h,b,c):
y = []
for x in lista_de_x:
y.append(-1*(h/(1+math.e**(c*(b-x)))))

figure()
plot(lista_de_x,y,'r')
xlabel('X')
ylabel('Sigmoidal Decreciente')
title('Funcion Sigmoidal Decreciente')
show()




#EL PROGRAMA ARRANCA AQUI!
puntos_en_x = linspace (0,10,100)


h = 1
b = 5
c = 1.5


plot_sigmoidaldecre(puntos_en_x,h,b,c)

SINOIDAL



from pylab import *
import matplotlib.pyplot as plt
import math




def plot_sinoidal(lista_de_x,h,b,c):
    y = []
    for x in lista_de_x:
        y.append(h/(1+math.e**(c*(b-x))))


    figure()
    plot(lista_de_x,y,'r')
    xlabel('X')
    ylabel('Sinoidal')
    title('Funcion Sinoidal')
    show()




#EL PROGRAMA ARRANCA AQUI!
    puntos_en_x = linspace (0,10,100)


h = 1
b = 4.5
c = 1.5


plot_sinoidal(puntos_en_x,h,b,c)

CAUCHIANA



from pylab import *
import matplotlib.pyplot as plt
import math


def plot_cauchiana(lista_de_x,h,b,c):
    y = []
    for x in lista_de_x:
        y.append(h/(1+abs((x-b)/a)**(2*c)))


    figure()
    plot(lista_de_x,y,'r')
    xlabel('X')
    ylabel('Cauchiana')
    title('Funcion Cauchiana')
    show()




#EL PROGRAMA ARRANCA AQUI!
    puntos_en_x = linspace (0,10,100)


h = 1
b = 4
c = 1.5



plot_cauchiana(puntos_en_x,h,b,c)

GAUSSIANA




from pylab import *
import matplotlib.pyplot as plt
import math

def plot_gaussiana(lista_de_x,h,b,c):
y = []
for x in lista_de_x:
y.append(h*(math.e ** -(((x-b)**2)/(2*(c**2)))))


figure()
plot(lista_de_x,y,'r')
xlabel('x')
ylabel('Gausiana')
title('Funcion Gaussiana')
show()


#EL PROGRAMA ARRANCA AQUI!
puntos_en_x = linspace (0,10,100)

h = 1
b = 5
c = 1.5


plot_gaussiana(puntos_en_x,h,b,c)







COSENOIDAL




from pylab import *
import matplotlib.pyplot as plt
import math


def plot_cosenoidal(lista_de_x,h,a,b):
M1=b-(1/a)
M2=b+(1/a)
y = []
for x in lista_de_x:
if M1<=x and x<=M2:
y.append(0.5*h*(1+cos((a*pi)*(x-b))))
else:
y.append(0)
figure()
plot(lista_de_x,y,'r')
xlabel('X')
ylabel('Cosenoidal')
title('Funcion Cosenoidal')
show()




#EL PROGRAMA ARRANCA AQUI!
puntos_en_x = linspace (0,10,100)


h = 1
a = 0.5
b = 5



plot_cosenoidal(puntos_en_x,h,a,b)

PICO

PICO


La función pico está conformada por 3 parametro h,b,c:
In [3]:
from pylab import *
import matplotlib.pyplot as plt
import math
def plot_pico(lista_de_x,h,b,c):
y = []
for x in lista_de_x:
y.append(math.e ** -abs( c * (x - b)))
figure()
plot(lista_de_x,y,'r')
xlabel('x')
ylabel('pico')
title('Funcion pico')
show()
#EL PROGRAMA ARRANCA AQUI!
puntos_en_x = linspace (0,10,100)
h = 1
b = 6
c = 2
plot_pico(puntos_en_x,h,b,c)

TRAPECIO Y TRIÁNGULO


El trapecio está conformado por 5 parámetros, h,a,b,c,d. Y la función está definida así:
In [*]:
from pylab import *
import matplotlib.pyplot as plt
def plot_trapecio(lista_de_x,h,a,b,c,d):
pendiente_1 = h/(b-a)
pendiente_2 = -h/(d-c)
y = []
for x in lista_de_x:
if x<=a:
y.append(0)
elif x>a and x<b:
y.append( (x-a)*pendiente_1 ) # (h*(x-a)) / (b-a)
elif x>=b and x<=c:
y.append(h)
elif x>c and x<d:
y.append((x-d)*pendiente_2) # (-h*(x-d)) / (d-c)
else:
y.append(0)
figure()
plot(lista_de_x,y,'r')
xlabel('X')
if b!=c:
ylabel('Trapecio')
title('Función Miembro Trapezoidal')
else:
ylabel('Triángulo')
title('Función Miembro Triangular')
show()
def plot_triangulo(lista_de_x,h,a,b,d):
plot_trapecio(lista_de_x,h,a,b,b,d) #El triangulo es un caso especial de 
trapecio donde B == C
#EL PROGRAMA ARRANCA AQUI!
puntos_en_x = linspace (0,10,100)
h = 1
a = 2
b = 4
c = 5.5
d = 8.3
plot_trapecio(puntos_en_x,h,a,b,c,d)
plot_triangulo(puntos_en_x,h,a,b,d)