00001
00002
00003 #include <PSQt/GUAxes.h>
00004 #include <PSQt/QGUtils.h>
00005
00006
00007
00008 #include <QtGui/QApplication>
00009
00010 #include <cmath>
00011 #include <iostream>
00012
00013 int main(int argc, char *argv[])
00014 {
00015 QApplication a(argc, argv);
00016
00017 float xmin = 0;
00018 float xmax = 30;
00019 float ymin = -4;
00020 float ymax = 12;
00021 unsigned pbits=1;
00022
00023 unsigned npts = 1000;
00024 float x1[npts];
00025 float y1[npts];
00026 float y2[npts];
00027 float y3[npts];
00028 float dx = (xmax-xmin)/(npts+1);
00029
00030 unsigned i=0;
00031 for(float x=xmin; x<xmax; x+=dx, i++) {
00032 x1[i] = x;
00033 y1[i] = 4*sin(x);
00034 y2[i] = 3*cos(5*x);
00035 y3[i] = (x>0) ? ymax*sin(x)/x : ymax;
00036
00037 }
00038
00039 PSQt::GUAxes* pax1 = new PSQt::GUAxes(0, xmin, xmax, ymin, ymax, pbits);
00040
00041
00042 PSQt::graph(pax1, x1, y1, npts, "-rT4");
00043 PSQt::graph(pax1, x1, y2, npts, "-kT");
00044 PSQt::graph(pax1, x1, y3, npts, "-bT");
00045
00046
00047
00048 pax1->show();
00049
00050
00051
00052
00053
00054 return a.exec();
00055 }
00056
00057