Mathematica-Einf�hrung
index
1
1b
2n
3
4
4b
5
6
7
8
9
10
Externes Programm aufrufen
Es kann auch sehr nützlich sein, externe Programme zur Datenauswertung
benutzen zu können.
Hier möchte ich eine sehr einfache Methode vorstellen, wie man so
etwas bewerkstelligen kann.
Nehmen wir an, wir haben ein C-Programm, das die Daten auswertet und
Text auf der Standardausgabe ausgibt:
#include
#include
main()
{
int i;
for (i=0; i<10; i++)
printf(" %.7g %.7g \n",i*0.50,sqrt(i*0.5));
exit(0);
}
Wenn man das Programm (nach dem compilieren) aufruft, bekommt man:
0 0
0.5 0.7071068
1 1
1.5 1.224745
2 1.414214
2.5 1.581139
3 1.732051
3.5 1.870829
4 2
4.5 2.12132
Dieses Programm kann man jetzt auch von Mathematica aufrufen.
In dem folgenden Beispiel werden die Daten graphisch dargestellt und diese
Graphik gleich als EPS-Datei und als GIF-Datei gespeichert:
![[Graphics:Images/myprog_gr_1.gif]](Images/myprog_gr_1.gif)
![[Graphics:Images/myprog_gr_2.gif]](Images/myprog_gr_2.gif)
![[Graphics:Images/myprog_gr_3.gif]](Images/myprog_gr_3.gif)
![[Graphics:Images/myprog_gr_4.gif]](Images/myprog_gr_4.gif)
![[Graphics:Images/myprog_gr_5.gif]](Images/myprog_gr_5.gif)
![[Graphics:Images/myprog_gr_6.gif]](Images/myprog_gr_6.gif)
![[Graphics:Images/myprog_gr_7.gif]](Images/myprog_gr_7.gif)
![[Graphics:Images/myprog_gr_8.gif]](Images/myprog_gr_8.gif)
![[Graphics:Images/myprog_gr_9.gif]](Images/myprog_gr_9.gif)
![[Graphics:Images/myprog_gr_12.gif]](Images/myprog_gr_12.gif)
![[Graphics:Images/myprog_gr_13.gif]](Images/myprog_gr_13.gif)
Converted by Mathematica
June 13, 2000
EPS-Datei
GIF-Datei: | | |
|  | |
| | |
(der gelbe Rand ist hier Hintergrund. Da das Bild selbst einen weissen
Hintergrund hat, sieht man sonst den Rand bzw. die Abmessungen des Bildes nicht.)
R. Weis (weis@uni-hd.de)