~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to examples/c++/x04.cc

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//---------------------------------------------------------------------------//
2
 
// $Id: x04.cc,v 1.6 2004/03/03 17:41:16 andrewross Exp $
 
2
// $Id: x04.cc,v 1.10 2005/10/07 19:10:11 airwin Exp $
3
3
//---------------------------------------------------------------------------//
4
4
//
5
5
//---------------------------------------------------------------------------//
19
19
//
20
20
// You should have received a copy of the GNU Library General Public License
21
21
// along with PLplot; if not, write to the Free Software
22
 
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
22
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
23
23
//---------------------------------------------------------------------------//
24
24
//
25
25
//---------------------------------------------------------------------------//
26
26
// Implementation of PLplot example 4 in C++.
27
27
//---------------------------------------------------------------------------//
28
28
 
29
 
#include "plstream.h"
30
 
 
31
 
#include <iostream>
32
 
#include <cmath>
 
29
#include "plc++demos.h"
33
30
 
34
31
#ifdef USE_NAMESPACE
35
32
using namespace std;
56
53
  pls = new plstream();
57
54
 
58
55
  // Parse and process command line arguments.
59
 
  pls->ParseOpts( &argc, argv, PL_PARSE_FULL );
 
56
  pls->parseopts( &argc, argv, PL_PARSE_FULL );
60
57
 
61
58
  // Initialize PLplot.
62
59
  pls->init();
87
84
  f0 = 1.0;
88
85
  for (i = 0; i <= 100; i++) {
89
86
    freql[i] = -2.0 + i / 20.0;
90
 
    freq = pow(10.0, freql[i]);
91
 
    ampl[i] = 20.0 * log10(1.0 / sqrt(1.0 + pow((freq / f0), 2.)));
92
 
    phase[i] = -(180.0 / M_PI) * atan(freq / f0);
 
87
    freq = pow(10.0, (double)freql[i]);
 
88
    ampl[i] = 20.0 * log10(1.0 / sqrt(1.0 + pow((double)(freq / f0), 2.)));
 
89
    phase[i] = -(180.0 / M_PI) * atan((double)(freq / f0));
93
90
  }
94
91
 
95
92
  pls->vpor(0.15, 0.85, 0.1, 0.9);