Last active
February 11, 2019 04:05
-
-
Save variux/51311532f81fb23fa71663ae5cf1a878 to your computer and use it in GitHub Desktop.
proyecto alejandro miranda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
numpy.set_printoptions(suppress=True) | |
def aceleracion(velocidad): | |
return (3-(0.000062*(velocidad**2))) | |
def velocidad(tiempo): | |
return (0.00001*(tiempo**3) - 0.00488*(tiempo**2) + 0.75795*tiempo + 181.3566) | |
def datos_velocidad_turbohelice(incremento): | |
rango = 130//incremento | |
datos = numpy.zeros((rango+1, 3)) | |
contador_tiempo = 0 | |
for fila in range(rango+1): | |
if contador_tiempo <= 130: | |
if rango < 1: | |
rango == 1 | |
for columna in range(3): | |
if columna == 0: | |
datos[fila][columna] = contador_tiempo | |
if columna == 1: | |
datos[fila][columna] = velocidad(contador_tiempo) | |
if columna == 2: | |
datos[fila][columna] = aceleracion(velocidad(contador_tiempo)) | |
contador_tiempo = contador_tiempo + incremento | |
return datos | |
incremental = int(input("ingrese el incremento: ")) | |
datos_final = datos_velocidad_turbohelice(incremental) | |
panda_df = pd.DataFrame(datos_final) | |
panda_df.columns = ['Tiempo (s)', 'Velocidad (m/s)', 'Aceleración (m/s^2)'] | |
print(panda_df) | |
print(panda_df.describe()) | |
#Separamos la velocidad, el tiempo y la aceleración | |
tiempos = [] | |
velocidades = [] | |
aceleraciones = [] | |
rango = 130//incremental | |
for i in range(rango + 1): | |
tiempos.append(datos_final[i][0]) | |
velocidades.append(datos_final[i][1]) | |
aceleraciones.append(datos_final[i][2]) | |
vel, acel = plt.subplots(2, sharex=True) | |
acel[0].plot(tiempos, aceleraciones) | |
acel[0].set_xlabel('Tiempo (s)') | |
acel[0].set_ylabel('Aceleración (m/s^2)') | |
acel[1].plot(tiempos, velocidades) | |
acel[1].set_xlabel('Tiempo (s)') | |
acel[1].set_ylabel('Velocidad (m/s^2)') | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment