PythonQ 240-8XX Bedienungsanleitung Seite 29

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 37
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 28
c
! www.simula.no/˜hpl
Plotting several curves in one plot
Compare f
1
(t)=t
2
e
t
2
and f
2
(t)=t
4
e
t
2
for t [0, 3]
from scitools.all import
*
#forcurveplotting
def f1(t):
return t
**
2
*
exp(-t
**
2)
def f2(t):
return t
**
2
*
f1(t)
t=linspace(0,3,51)
y1 = f1(t)
y2 = f2(t)
plot(t, y1)
hold(’on’) # continue plotting in the same plot
plot(t, y2)
xlabel(’t’)
ylabel(’y’)
legend(’t^2
*
exp(-t^2)’, ’t^4
*
exp(-t^2)’)
title(’Plotting two curves in the same plot’)
hardcopy(’tmp2.eps’)
Numerical Python – p. 263/728
Seitenansicht 28
1 2 ... 24 25 26 27 28 29 30 31 32 33 34 35 36 37

Kommentare zu diesen Handbüchern

Keine Kommentare