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 50
| from pylab import*
M=loadtxt('data.txt')
print M
taille =shape (M)
nb= size (M)
print "taille de la matrice", taille
print "nombre d'element", nb
def moyg (x):
N=len(x)
print N
M=zeros((N-2,))
for i in range(0,N-2):
a=array([1,2,1])
l=(x[i,1])*a[0]
s=(x[(i+1),1])*a[1]
s1=(x[(i+2),1])*a[2]
S=s+s1+l
M[i]=S/3
return M
Tmoy=moyg(M)
print Tmoy
t=M[0:141,0]
x=t
y=Tmoy
xlabel("Temps ( minutes)")
ylabel("Temperature (C)")
title( " Moyenne Ponderee ")
plot(x,y)
show ()
f=M[:,1]
f1=arange(0,len(f))
h=[1,2,1]
c=zeros (M.shape)
for i in range (0,len(f)-2):
h=array ([1,2,1])
h1[i]=h[0]*(x[i])
h2[i]=h[1]*(x[i,1])
h3[i]=h[2]*(x[i,2])
H=(h1+h2+h3)/3
print H |
Partager