-
Notifications
You must be signed in to change notification settings - Fork 0
/
pila.py
51 lines (40 loc) · 1.17 KB
/
pila.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python
# -*- coding: utf8 -*-
# Soubor: pila.py
# Datum: 24.01.2013 09:01
# Autor: Marek Nožka, nozka <@t> spseol <d.t> cz
# Licence: GNU/GPL
# Úloha: časový průběh pila ( trojuhelník)
############################################################################
import matplotlib as mpl
mpl.use('GTKAgg')
mpl.use('Qt4Agg')
#mpl.rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
## for Palatino and other serif fonts use:
#mpl.rc('font',**{'family':'serif','serif':['Palatino']})
#mpl.rc('lines', linewidth=2, color='r')
mpl.rc('font', family = 'serif', serif = 'cmr10')
mpl.rcParams['text.usetex']=True
mpl.rcParams['text.latex.unicode']=True
import numpy as num
import scipy as sci
import pylab as lab
from pylab import pi
############################################################################
t = lab.linspace(0,10,100)
u = lab.zeros(100)
hodnota=0
prirustek=0.1
j=0 # index vzorku
while j<len(u):
while hodnota<2 and j<len(u):
u[j] = hodnota
j+=1
hodnota += prirustek
while hodnota>0 and j<len(u):
u[j] = hodnota
j+=1
hodnota -= prirustek
lab.plot(t,u)
lab.grid()
lab.show()