форкнуто от main/python-labs
Родитель
1e45e84775
Сommit
4b903bc3af
@ -0,0 +1,17 @@
|
|||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from module1 import *
|
||||||
|
|
||||||
|
yval = []
|
||||||
|
|
||||||
|
fp = open('test.txt', 'w')
|
||||||
|
for i in gen(-4, 5, 1, a, b, T):
|
||||||
|
fp.write(str(i[0]) + '\n')
|
||||||
|
fp.close()
|
||||||
|
|
||||||
|
fp = open('test.txt', 'r')
|
||||||
|
for x in fp:
|
||||||
|
yval.append(float(x.rstrip('\n')))
|
||||||
|
fp.close()
|
||||||
|
|
||||||
|
plt.plot(yval)
|
||||||
|
plt.show()
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
import math
|
||||||
|
|
||||||
|
a = 2
|
||||||
|
b = -6
|
||||||
|
T = 1.5
|
||||||
|
anfun = lambda a, b, x, T: a*math.sin(x)+b*math.cos(x+T)
|
||||||
|
|
||||||
|
def gen(start, fin, shag, a, b, T):
|
||||||
|
x = start
|
||||||
|
while x <= fin:
|
||||||
|
yield [anfun(a, b, x, T)]
|
||||||
|
x += shag
|
||||||
Загрузка…
Ссылка в новой задаче