Skip to content

Instantly share code, notes, and snippets.

@malja
Created January 3, 2018 13:23
Show Gist options
  • Save malja/1eda53c0a89ae2720ddfe5a95ace6d80 to your computer and use it in GitHub Desktop.
Save malja/1eda53c0a89ae2720ddfe5a95ace6d80 to your computer and use it in GitHub Desktop.
PPS test grafy
import matplotlib.pyplot as plt
ekg_data = []
fpg_data = []
with open("./zadani/ekg.txt") as file:
for line in file:
ekg_data.append( float(line.replace("\n", "").replace("o", "0").replace(",", ".")) )
with open("./zadani/fpg.txt") as file:
for line in file:
fpg_data.append( float(line.replace("\n", "").replace("o", "0").replace(",", ".")) )
figure = plt.figure(1)
axes = figure.gca()
axes.plot(ekg_data, linestyle="-", color="green", linewidth=1.0)
plt.title("EKG")
figure2 = plt.figure(2)
axes2 = figure2.gca()
axes2.plot( fpg_data )
plt.title("FPG")
figure3 = plt.figure(3)
axes3 = figure3.gca()
axes3.plot( ekg_data, fpg_data )
plt.title("y = f(x)")
plt.ylabel("y")
plt.xlabel("x")
plt.show()
# mpl
import matplotlib
from mpl_toolkits.mplot3d import Axes3D
# np
import numpy
#plt
import matplotlib.pyplot
# Range pro float
def frange(x, y, jump):
while x < y:
yield x
x += jump
# Netřeba
matplotlib.rcParams['legend.fontsize'] = 10
graph = matplotlib.pyplot.figure()
axes = graph.gca(projection='3d')
x_list = []
y_list = []
z_list = []
for x in frange(0, 2, 0.02):
for y in frange(0, 2, 0.02):
z = ( numpy.sin(2*x)+numpy.cos(2*y) ) / (1+x+y)
x_list.append(x)
y_list.append(y)
z_list.append(z)
axes.plot(x_list, y_list, z_list, label='test')
axes.legend()
matplotlib.pyplot.show()
import numpy
from numpy.linalg import det
a = [[1,2], [-2,1], [2,5], [1,1]]
b = [[1,2], [0.5, 3]]
c = [[1,4,2,1],[3,2,0,1]]
# Násobení A*B
ab = numpy.dot(a,b)
# Násobení A*B*C
abc = numpy.dot(ab,c)
detabc = numpy.linalg.det(abc)
# Determinant ABC
print(round(detabc,3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment