0.2.5 FunctionGenerator

This commit is contained in:
Rob Tillaart 2023-03-26 10:32:34 +02:00
parent 7132bb78bd
commit cdd3ab20e6
20 changed files with 1353 additions and 168 deletions

View File

@ -6,7 +6,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: arduino/arduino-lint-action@v1
with:
library-manager: update

View File

@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6

View File

@ -10,7 +10,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: json-syntax-check
uses: limitusus/json-syntax-check@v1
with:

View File

@ -6,12 +6,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.2.5] - 2023-03-25
- add **setDutyCycle()**, **getDutyCycle()**
- implement duty cycle for square(), triangle() and random()
- add **seedRandom(a, b)**
- add some optimizations
- move code from .h to .cpp
- update readme.md
- update GitHub actions
- update license 2023
- minor edits
## [0.2.4] - 2022-11-07
- add changelog.md
- add rp2040 to build-CI
- update readme.md
## [0.2.3] - 2021-12-18
- update library.json, license, minor edits

View File

@ -2,15 +2,14 @@
//
// FILE: functionGenerator.h
// AUTHOR: Rob Tillaart
// VERSION: 0.2.4
// VERSION: 0.2.5
// PURPOSE: wave form generating functions (use with care)
// URL: https://github.com/RobTillaart/FunctionGenerator
//
#include "Arduino.h"
#define FUNCTIONGENERATOR_LIB_VERSION (F("0.2.4"))
#define FUNCTIONGENERATOR_LIB_VERSION (F("0.2.5"))
class funcgen
@ -18,31 +17,51 @@ class funcgen
public:
funcgen(float period = 1.0, float amplitude = 1.0, float phase = 0.0, float yShift = 0.0);
// configuration
/////////////////////////////////////////////////////////////
//
// CONFIGURATION
//
void setPeriod(float period = 1.0);
float getPeriod() { return _period; };
void setFrequency(float freq = 1.0) { setPeriod(1/freq); };
float getFrequency() { return _freq1; };
float getPeriod();
void setAmplitude(float ampl = 1.0) { _amplitude = ampl; };
float getAmplitude() { return _amplitude; };
void setPhase(float phase = 0.0) { _phase = phase; };
float getPhase() { return _phase; };
void setYShift(float yShift = 0.0) { _yShift = yShift; };
float getYShift() { return _yShift; };
void setFrequency(float freq = 1.0);
float getFrequency();
void setAmplitude(float ampl = 1.0);
float getAmplitude();
void setPhase(float phase = 0.0);
float getPhase();
void setYShift(float yShift = 0.0);
float getYShift();
void setDutyCycle(float dutyCycle);
float getDutyCycle();
void setRandomSeed(uint32_t a, uint32_t b = 314159265);
/////////////////////////////////////////////////////////////
//
// FUNCTIONS
//
// constant amplitude
float line();
// constant zero for calibration
// constant zero for calibration.
float zero();
// standard wave forms
float sawtooth(float t, uint8_t mode = 0);
float sawtooth(float t, uint8_t mode = 0); // 0 ==> /|. 1 ==> sawtooth |\.
float triangle(float t);
float square(float t);
float sinus(float t);
float stair(float t, uint16_t steps = 8, uint8_t mode = 0);
float random();
float random_DC(); // duty cycle variant. Experimental.
private:
float _period;
@ -53,6 +72,8 @@ private:
float _amplitude;
float _phase;
float _yShift;
float _dutyCycle;
// Marsaglia 'constants'
uint32_t _m_w = 1;
uint32_t _m_z = 2;

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2015-2022 Rob Tillaart
Copyright (c) 2015-2023 Rob Tillaart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -4,7 +4,6 @@
// PURPOSE: demo function generators
// DATE: 2015-01-03
// URL: https://github.com/RobTillaart/FunctionGenerator
//
#include "functionGenerator.h"

View File

@ -17,7 +17,9 @@ funcgen gen2;
void setup()
{
Serial.begin(115200);
// Serial.print("Start functionGeneratorPerformance - LIB VERSION: ");
// Serial.println();
// Serial.println(__FILE__);
// Serial.print("FUNCTIONGENERATOR_LIB_VERSION: ");
// Serial.println(FUNCTIONGENERATOR_LIB_VERSION);
gen1.setFrequency(13);

View File

@ -4,7 +4,6 @@
// PURPOSE: demo function generators
// DATE: 2015-01-01
// URL: https://github.com/RobTillaart/FunctionGenerator
//
#include "functionGenerator.h"
@ -38,6 +37,8 @@ void setup()
delay(10);
test_random();
delay(10);
test_random_DC();
delay(10);
test_line();
delay(10);
test_zero();
@ -169,6 +170,22 @@ void test_random()
}
void test_random_DC()
{
start = micros();
for (int i = 0; i < 10000; i++)
{
t = gen.random_DC();
}
stop = micros();
Serial.print(__FUNCTION__);
Serial.print(":\t");
Serial.print((stop - start) / 10000.0);
Serial.print("\t");
Serial.println(1000000.0 / ((stop - start) / 10000.0));
}
void test_line()
{
start = micros();

View File

@ -0,0 +1,414 @@
Start functionGeneratorPerformance - LIB VERSION: 0.2.4
func usec max calls/sec
test_square: 53.00 18869.07
test_sawtooth: 62.13 16095.80
test_triangle: 74.89 13352.77
test_sinus: 164.87 6065.36
test_stair: 81.30 12299.52
test_random: 37.71 26518.17
test_line: 0.76 1324152.50
test_zero: 0.76 1324152.50
t sqr saw tri sin str rnd line zero
-4.00 -1.00 1.00 -1.00 -0.00 1.00 0.37 1.00 0.00
-3.98 1.00 -0.96 -0.92 0.13 -1.00 0.13 1.00 0.00
-3.96 1.00 -0.92 -0.84 0.25 -1.00 0.21 1.00 0.00
-3.94 1.00 -0.88 -0.76 0.37 -1.00 0.37 1.00 0.00
-3.92 1.00 -0.84 -0.68 0.48 -1.00 0.50 1.00 0.00
-3.90 1.00 -0.80 -0.60 0.59 -1.00 0.96 1.00 0.00
-3.88 1.00 -0.76 -0.52 0.68 -1.00 0.15 1.00 0.00
-3.86 1.00 -0.72 -0.44 0.77 -0.71 0.92 1.00 0.00
-3.84 1.00 -0.68 -0.36 0.84 -0.71 0.21 1.00 0.00
-3.82 1.00 -0.64 -0.28 0.90 -0.71 0.69 1.00 0.00
-3.80 1.00 -0.60 -0.20 0.95 -0.71 0.82 1.00 0.00
-3.78 1.00 -0.56 -0.12 0.98 -0.71 0.33 1.00 0.00
-3.76 1.00 -0.52 -0.04 1.00 -0.71 0.96 1.00 0.00
-3.74 1.00 -0.48 0.04 1.00 -0.43 0.63 1.00 0.00
-3.72 1.00 -0.44 0.12 0.98 -0.43 0.23 1.00 0.00
-3.70 1.00 -0.40 0.20 0.95 -0.43 0.12 1.00 0.00
-3.68 1.00 -0.36 0.28 0.90 -0.43 0.74 1.00 0.00
-3.66 1.00 -0.32 0.36 0.84 -0.43 0.19 1.00 0.00
-3.64 1.00 -0.28 0.44 0.77 -0.43 0.60 1.00 0.00
-3.62 1.00 -0.24 0.52 0.68 -0.14 0.24 1.00 0.00
-3.60 1.00 -0.20 0.60 0.59 -0.14 0.23 1.00 0.00
-3.58 1.00 -0.16 0.68 0.48 -0.14 0.23 1.00 0.00
-3.56 1.00 -0.12 0.76 0.37 -0.14 0.96 1.00 0.00
-3.54 1.00 -0.08 0.84 0.25 -0.14 0.01 1.00 0.00
-3.52 1.00 -0.04 0.92 0.13 -0.14 0.10 1.00 0.00
-3.50 1.00 0.00 1.00 0.00 -0.14 0.63 1.00 0.00
-3.48 -1.00 0.04 0.92 -0.13 0.14 0.16 1.00 0.00
-3.46 -1.00 0.08 0.84 -0.25 0.14 0.62 1.00 0.00
-3.44 -1.00 0.12 0.76 -0.37 0.14 0.91 1.00 0.00
-3.42 -1.00 0.16 0.68 -0.48 0.14 0.98 1.00 0.00
-3.40 -1.00 0.20 0.60 -0.59 0.14 0.73 1.00 0.00
-3.38 -1.00 0.24 0.52 -0.68 0.14 0.14 1.00 0.00
-3.36 -1.00 0.28 0.44 -0.77 0.43 0.53 1.00 0.00
-3.34 -1.00 0.32 0.36 -0.84 0.43 0.11 1.00 0.00
-3.32 -1.00 0.36 0.28 -0.90 0.43 0.21 1.00 0.00
-3.30 -1.00 0.40 0.20 -0.95 0.43 0.17 1.00 0.00
-3.28 -1.00 0.44 0.12 -0.98 0.43 0.36 1.00 0.00
-3.26 -1.00 0.48 0.04 -1.00 0.43 0.89 1.00 0.00
-3.24 -1.00 0.52 -0.04 -1.00 0.71 0.16 1.00 0.00
-3.22 -1.00 0.56 -0.12 -0.98 0.71 0.19 1.00 0.00
-3.20 -1.00 0.60 -0.20 -0.95 0.71 0.13 1.00 0.00
-3.18 -1.00 0.64 -0.28 -0.90 0.71 0.12 1.00 0.00
-3.16 -1.00 0.68 -0.36 -0.84 0.71 0.20 1.00 0.00
-3.14 -1.00 0.72 -0.44 -0.77 0.71 0.81 1.00 0.00
-3.12 -1.00 0.76 -0.52 -0.68 1.00 0.52 1.00 0.00
-3.10 -1.00 0.80 -0.60 -0.59 1.00 0.82 1.00 0.00
-3.08 -1.00 0.84 -0.68 -0.48 1.00 0.28 1.00 0.00
-3.06 -1.00 0.88 -0.76 -0.37 1.00 0.57 1.00 0.00
-3.04 -1.00 0.92 -0.84 -0.25 1.00 0.30 1.00 0.00
-3.02 -1.00 0.96 -0.92 -0.13 1.00 0.08 1.00 0.00
-3.00 -1.00 1.00 -1.00 -0.00 1.00 0.20 1.00 0.00
-2.98 1.00 -0.96 -0.92 0.13 -1.00 0.44 1.00 0.00
-2.96 1.00 -0.92 -0.84 0.25 -1.00 0.98 1.00 0.00
-2.94 1.00 -0.88 -0.76 0.37 -1.00 0.65 1.00 0.00
-2.92 1.00 -0.84 -0.68 0.48 -1.00 0.70 1.00 0.00
-2.90 1.00 -0.80 -0.60 0.59 -1.00 0.02 1.00 0.00
-2.88 1.00 -0.76 -0.52 0.68 -1.00 0.39 1.00 0.00
-2.86 1.00 -0.72 -0.44 0.77 -0.71 0.95 1.00 0.00
-2.84 1.00 -0.68 -0.36 0.84 -0.71 0.12 1.00 0.00
-2.82 1.00 -0.64 -0.28 0.90 -0.71 0.79 1.00 0.00
-2.80 1.00 -0.60 -0.20 0.95 -0.71 0.65 1.00 0.00
-2.78 1.00 -0.56 -0.12 0.98 -0.71 0.62 1.00 0.00
-2.76 1.00 -0.52 -0.04 1.00 -0.71 0.01 1.00 0.00
-2.74 1.00 -0.48 0.04 1.00 -0.43 0.62 1.00 0.00
-2.72 1.00 -0.44 0.12 0.98 -0.43 0.78 1.00 0.00
-2.70 1.00 -0.40 0.20 0.95 -0.43 0.55 1.00 0.00
-2.68 1.00 -0.36 0.28 0.90 -0.43 0.06 1.00 0.00
-2.66 1.00 -0.32 0.36 0.84 -0.43 0.84 1.00 0.00
-2.64 1.00 -0.28 0.44 0.77 -0.43 0.75 1.00 0.00
-2.62 1.00 -0.24 0.52 0.68 -0.14 0.71 1.00 0.00
-2.60 1.00 -0.20 0.60 0.59 -0.14 0.50 1.00 0.00
-2.58 1.00 -0.16 0.68 0.48 -0.14 0.82 1.00 0.00
-2.56 1.00 -0.12 0.76 0.37 -0.14 0.37 1.00 0.00
-2.54 1.00 -0.08 0.84 0.25 -0.14 0.44 1.00 0.00
-2.52 1.00 -0.04 0.92 0.13 -0.14 0.47 1.00 0.00
-2.50 1.00 0.00 1.00 0.00 -0.14 0.00 1.00 0.00
-2.48 -1.00 0.04 0.92 -0.13 0.14 0.25 1.00 0.00
-2.46 -1.00 0.08 0.84 -0.25 0.14 0.01 1.00 0.00
-2.44 -1.00 0.12 0.76 -0.37 0.14 0.11 1.00 0.00
-2.42 -1.00 0.16 0.68 -0.48 0.14 0.76 1.00 0.00
-2.40 -1.00 0.20 0.60 -0.59 0.14 0.77 1.00 0.00
-2.38 -1.00 0.24 0.52 -0.68 0.14 0.61 1.00 0.00
-2.36 -1.00 0.28 0.44 -0.77 0.43 0.52 1.00 0.00
-2.34 -1.00 0.32 0.36 -0.84 0.43 0.78 1.00 0.00
-2.32 -1.00 0.36 0.28 -0.90 0.43 0.35 1.00 0.00
-2.30 -1.00 0.40 0.20 -0.95 0.43 0.77 1.00 0.00
-2.28 -1.00 0.44 0.12 -0.98 0.43 0.20 1.00 0.00
-2.26 -1.00 0.48 0.04 -1.00 0.43 0.04 1.00 0.00
-2.24 -1.00 0.52 -0.04 -1.00 0.71 0.46 1.00 0.00
-2.22 -1.00 0.56 -0.12 -0.98 0.71 0.00 1.00 0.00
-2.20 -1.00 0.60 -0.20 -0.95 0.71 0.96 1.00 0.00
-2.18 -1.00 0.64 -0.28 -0.90 0.71 0.07 1.00 0.00
-2.16 -1.00 0.68 -0.36 -0.84 0.71 0.14 1.00 0.00
-2.14 -1.00 0.72 -0.44 -0.77 0.71 0.27 1.00 0.00
-2.12 -1.00 0.76 -0.52 -0.68 1.00 0.30 1.00 0.00
-2.10 -1.00 0.80 -0.60 -0.59 1.00 0.56 1.00 0.00
-2.08 -1.00 0.84 -0.68 -0.48 1.00 0.28 1.00 0.00
-2.06 -1.00 0.88 -0.76 -0.37 1.00 0.59 1.00 0.00
-2.04 -1.00 0.92 -0.84 -0.25 1.00 0.37 1.00 0.00
-2.02 -1.00 0.96 -0.92 -0.13 1.00 0.45 1.00 0.00
-2.00 -1.00 1.00 -1.00 -0.00 1.00 0.95 1.00 0.00
-1.98 1.00 -0.96 -0.92 0.13 -1.00 0.06 1.00 0.00
-1.96 1.00 -0.92 -0.84 0.25 -1.00 0.42 1.00 0.00
-1.94 1.00 -0.88 -0.76 0.37 -1.00 0.80 1.00 0.00
-1.92 1.00 -0.84 -0.68 0.48 -1.00 0.83 1.00 0.00
-1.90 1.00 -0.80 -0.60 0.59 -1.00 0.00 1.00 0.00
-1.88 1.00 -0.76 -0.52 0.68 -1.00 0.13 1.00 0.00
-1.86 1.00 -0.72 -0.44 0.77 -0.71 0.27 1.00 0.00
-1.84 1.00 -0.68 -0.36 0.84 -0.71 0.44 1.00 0.00
-1.82 1.00 -0.64 -0.28 0.90 -0.71 0.25 1.00 0.00
-1.80 1.00 -0.60 -0.20 0.95 -0.71 0.95 1.00 0.00
-1.78 1.00 -0.56 -0.12 0.98 -0.71 0.85 1.00 0.00
-1.76 1.00 -0.52 -0.04 1.00 -0.71 0.83 1.00 0.00
-1.74 1.00 -0.48 0.04 1.00 -0.43 0.32 1.00 0.00
-1.72 1.00 -0.44 0.12 0.98 -0.43 0.81 1.00 0.00
-1.70 1.00 -0.40 0.20 0.95 -0.43 0.02 1.00 0.00
-1.68 1.00 -0.36 0.28 0.90 -0.43 0.11 1.00 0.00
-1.66 1.00 -0.32 0.36 0.84 -0.43 0.98 1.00 0.00
-1.64 1.00 -0.28 0.44 0.77 -0.43 0.54 1.00 0.00
-1.62 1.00 -0.24 0.52 0.68 -0.14 0.65 1.00 0.00
-1.60 1.00 -0.20 0.60 0.59 -0.14 0.50 1.00 0.00
-1.58 1.00 -0.16 0.68 0.48 -0.14 0.39 1.00 0.00
-1.56 1.00 -0.12 0.76 0.37 -0.14 0.26 1.00 0.00
-1.54 1.00 -0.08 0.84 0.25 -0.14 0.20 1.00 0.00
-1.52 1.00 -0.04 0.92 0.13 -0.14 0.26 1.00 0.00
-1.50 1.00 0.00 1.00 0.00 -0.14 0.77 1.00 0.00
-1.48 -1.00 0.04 0.92 -0.13 0.14 0.50 1.00 0.00
-1.46 -1.00 0.08 0.84 -0.25 0.14 0.06 1.00 0.00
-1.44 -1.00 0.12 0.76 -0.37 0.14 0.04 1.00 0.00
-1.42 -1.00 0.16 0.68 -0.48 0.14 0.98 1.00 0.00
-1.40 -1.00 0.20 0.60 -0.59 0.14 0.65 1.00 0.00
-1.38 -1.00 0.24 0.52 -0.68 0.14 0.34 1.00 0.00
-1.36 -1.00 0.28 0.44 -0.77 0.43 0.89 1.00 0.00
-1.34 -1.00 0.32 0.36 -0.84 0.43 0.67 1.00 0.00
-1.32 -1.00 0.36 0.28 -0.90 0.43 0.13 1.00 0.00
-1.30 -1.00 0.40 0.20 -0.95 0.43 0.85 1.00 0.00
-1.28 -1.00 0.44 0.12 -0.98 0.43 0.06 1.00 0.00
-1.26 -1.00 0.48 0.04 -1.00 0.43 0.20 1.00 0.00
-1.24 -1.00 0.52 -0.04 -1.00 0.71 0.79 1.00 0.00
-1.22 -1.00 0.56 -0.12 -0.98 0.71 0.31 1.00 0.00
-1.20 -1.00 0.60 -0.20 -0.95 0.71 0.75 1.00 0.00
-1.18 -1.00 0.64 -0.28 -0.90 0.71 0.84 1.00 0.00
-1.16 -1.00 0.68 -0.36 -0.84 0.71 0.47 1.00 0.00
-1.14 -1.00 0.72 -0.44 -0.77 0.71 0.05 1.00 0.00
-1.12 -1.00 0.76 -0.52 -0.68 1.00 0.27 1.00 0.00
-1.10 -1.00 0.80 -0.60 -0.59 1.00 0.81 1.00 0.00
-1.08 -1.00 0.84 -0.68 -0.48 1.00 0.60 1.00 0.00
-1.06 -1.00 0.88 -0.76 -0.37 1.00 0.20 1.00 0.00
-1.04 -1.00 0.92 -0.84 -0.25 1.00 0.74 1.00 0.00
-1.02 -1.00 0.96 -0.92 -0.13 1.00 0.79 1.00 0.00
-1.00 -1.00 1.00 -1.00 -0.00 1.00 0.06 1.00 0.00
-0.98 1.00 -0.96 -0.92 0.13 -1.00 0.18 1.00 0.00
-0.96 1.00 -0.92 -0.84 0.25 -1.00 0.79 1.00 0.00
-0.94 1.00 -0.88 -0.76 0.37 -1.00 0.42 1.00 0.00
-0.92 1.00 -0.84 -0.68 0.48 -1.00 0.98 1.00 0.00
-0.90 1.00 -0.80 -0.60 0.59 -1.00 0.64 1.00 0.00
-0.88 1.00 -0.76 -0.52 0.68 -1.00 0.30 1.00 0.00
-0.86 1.00 -0.72 -0.44 0.77 -0.71 0.34 1.00 0.00
-0.84 1.00 -0.68 -0.36 0.84 -0.71 0.22 1.00 0.00
-0.82 1.00 -0.64 -0.28 0.90 -0.71 0.69 1.00 0.00
-0.80 1.00 -0.60 -0.20 0.95 -0.71 0.92 1.00 0.00
-0.78 1.00 -0.56 -0.12 0.98 -0.71 0.16 1.00 0.00
-0.76 1.00 -0.52 -0.04 1.00 -0.71 0.64 1.00 0.00
-0.74 1.00 -0.48 0.04 1.00 -0.43 0.91 1.00 0.00
-0.72 1.00 -0.44 0.12 0.98 -0.43 0.61 1.00 0.00
-0.70 1.00 -0.40 0.20 0.95 -0.43 0.65 1.00 0.00
-0.68 1.00 -0.36 0.28 0.90 -0.43 0.79 1.00 0.00
-0.66 1.00 -0.32 0.36 0.84 -0.43 0.73 1.00 0.00
-0.64 1.00 -0.28 0.44 0.77 -0.43 0.99 1.00 0.00
-0.62 1.00 -0.24 0.52 0.68 -0.14 0.91 1.00 0.00
-0.60 1.00 -0.20 0.60 0.59 -0.14 0.77 1.00 0.00
-0.58 1.00 -0.16 0.68 0.48 -0.14 0.97 1.00 0.00
-0.56 1.00 -0.12 0.76 0.37 -0.14 0.05 1.00 0.00
-0.54 1.00 -0.08 0.84 0.25 -0.14 0.03 1.00 0.00
-0.52 1.00 -0.04 0.92 0.13 -0.14 0.21 1.00 0.00
-0.50 1.00 0.00 1.00 0.00 -0.14 0.94 1.00 0.00
-0.48 -1.00 0.04 0.92 -0.13 0.14 0.83 1.00 0.00
-0.46 -1.00 0.08 0.84 -0.25 0.14 0.57 1.00 0.00
-0.44 -1.00 0.12 0.76 -0.37 0.14 0.70 1.00 0.00
-0.42 -1.00 0.16 0.68 -0.48 0.14 0.11 1.00 0.00
-0.40 -1.00 0.20 0.60 -0.59 0.14 0.84 1.00 0.00
-0.38 -1.00 0.24 0.52 -0.68 0.14 0.52 1.00 0.00
-0.36 -1.00 0.28 0.44 -0.77 0.43 0.31 1.00 0.00
-0.34 -1.00 0.32 0.36 -0.84 0.43 0.16 1.00 0.00
-0.32 -1.00 0.36 0.28 -0.90 0.43 0.53 1.00 0.00
-0.30 -1.00 0.40 0.20 -0.95 0.43 0.48 1.00 0.00
-0.28 -1.00 0.44 0.12 -0.98 0.43 0.39 1.00 0.00
-0.26 -1.00 0.48 0.04 -1.00 0.43 0.57 1.00 0.00
-0.24 -1.00 0.52 -0.04 -1.00 0.71 0.73 1.00 0.00
-0.22 -1.00 0.56 -0.12 -0.98 0.71 0.74 1.00 0.00
-0.20 -1.00 0.60 -0.20 -0.95 0.71 0.61 1.00 0.00
-0.18 -1.00 0.64 -0.28 -0.90 0.71 0.36 1.00 0.00
-0.16 -1.00 0.68 -0.36 -0.84 0.71 0.32 1.00 0.00
-0.14 -1.00 0.72 -0.44 -0.77 0.71 0.37 1.00 0.00
-0.12 -1.00 0.76 -0.52 -0.68 1.00 0.27 1.00 0.00
-0.10 -1.00 0.80 -0.60 -0.59 1.00 0.10 1.00 0.00
-0.08 -1.00 0.84 -0.68 -0.48 1.00 0.96 1.00 0.00
-0.06 -1.00 0.88 -0.76 -0.37 1.00 0.45 1.00 0.00
-0.04 -1.00 0.92 -0.84 -0.25 1.00 0.84 1.00 0.00
-0.02 -1.00 0.96 -0.92 -0.13 1.00 0.76 1.00 0.00
0.00 1.00 -1.00 -1.00 0.00 -1.00 0.67 1.00 0.00
0.02 1.00 -0.96 -0.92 0.13 -1.00 0.68 1.00 0.00
0.04 1.00 -0.92 -0.84 0.25 -1.00 0.36 1.00 0.00
0.06 1.00 -0.88 -0.76 0.37 -1.00 0.18 1.00 0.00
0.08 1.00 -0.84 -0.68 0.48 -1.00 0.66 1.00 0.00
0.10 1.00 -0.80 -0.60 0.59 -1.00 0.71 1.00 0.00
0.12 1.00 -0.76 -0.52 0.68 -1.00 0.71 1.00 0.00
0.14 1.00 -0.72 -0.44 0.77 -0.71 0.08 1.00 0.00
0.16 1.00 -0.68 -0.36 0.84 -0.71 0.98 1.00 0.00
0.18 1.00 -0.64 -0.28 0.90 -0.71 0.30 1.00 0.00
0.20 1.00 -0.60 -0.20 0.95 -0.71 0.42 1.00 0.00
0.22 1.00 -0.56 -0.12 0.98 -0.71 0.78 1.00 0.00
0.24 1.00 -0.52 -0.04 1.00 -0.71 0.99 1.00 0.00
0.26 1.00 -0.48 0.04 1.00 -0.43 0.10 1.00 0.00
0.28 1.00 -0.44 0.12 0.98 -0.43 0.79 1.00 0.00
0.30 1.00 -0.40 0.20 0.95 -0.43 0.22 1.00 0.00
0.32 1.00 -0.36 0.28 0.90 -0.43 0.85 1.00 0.00
0.34 1.00 -0.32 0.36 0.84 -0.43 0.55 1.00 0.00
0.36 1.00 -0.28 0.44 0.77 -0.43 0.31 1.00 0.00
0.38 1.00 -0.24 0.52 0.68 -0.14 0.05 1.00 0.00
0.40 1.00 -0.20 0.60 0.59 -0.14 0.92 1.00 0.00
0.42 1.00 -0.16 0.68 0.48 -0.14 0.34 1.00 0.00
0.44 1.00 -0.12 0.76 0.37 -0.14 0.98 1.00 0.00
0.46 1.00 -0.08 0.84 0.25 -0.14 0.09 1.00 0.00
0.48 1.00 -0.04 0.92 0.13 -0.14 0.44 1.00 0.00
0.50 -1.00 0.00 1.00 -0.00 0.14 0.30 1.00 0.00
0.52 -1.00 0.04 0.92 -0.13 0.14 0.14 1.00 0.00
0.54 -1.00 0.08 0.84 -0.25 0.14 0.37 1.00 0.00
0.56 -1.00 0.12 0.76 -0.37 0.14 0.20 1.00 0.00
0.58 -1.00 0.16 0.68 -0.48 0.14 0.85 1.00 0.00
0.60 -1.00 0.20 0.60 -0.59 0.14 0.00 1.00 0.00
0.62 -1.00 0.24 0.52 -0.68 0.14 0.06 1.00 0.00
0.64 -1.00 0.28 0.44 -0.77 0.43 0.36 1.00 0.00
0.66 -1.00 0.32 0.36 -0.84 0.43 0.69 1.00 0.00
0.68 -1.00 0.36 0.28 -0.90 0.43 0.14 1.00 0.00
0.70 -1.00 0.40 0.20 -0.95 0.43 0.52 1.00 0.00
0.72 -1.00 0.44 0.12 -0.98 0.43 0.55 1.00 0.00
0.74 -1.00 0.48 0.04 -1.00 0.43 0.49 1.00 0.00
0.76 -1.00 0.52 -0.04 -1.00 0.71 0.48 1.00 0.00
0.78 -1.00 0.56 -0.12 -0.98 0.71 0.17 1.00 0.00
0.80 -1.00 0.60 -0.20 -0.95 0.71 0.98 1.00 0.00
0.82 -1.00 0.64 -0.28 -0.90 0.71 0.35 1.00 0.00
0.84 -1.00 0.68 -0.36 -0.84 0.71 0.17 1.00 0.00
0.86 -1.00 0.72 -0.44 -0.77 0.71 0.59 1.00 0.00
0.88 -1.00 0.76 -0.52 -0.68 1.00 0.01 1.00 0.00
0.90 -1.00 0.80 -0.60 -0.59 1.00 0.13 1.00 0.00
0.92 -1.00 0.84 -0.68 -0.48 1.00 0.30 1.00 0.00
0.94 -1.00 0.88 -0.76 -0.37 1.00 0.97 1.00 0.00
0.96 -1.00 0.92 -0.84 -0.25 1.00 0.86 1.00 0.00
0.98 -1.00 0.96 -0.92 -0.13 1.00 0.30 1.00 0.00
1.00 1.00 -1.00 -1.00 0.00 -1.00 0.07 1.00 0.00
1.02 1.00 -0.96 -0.92 0.13 -1.00 0.48 1.00 0.00
1.04 1.00 -0.92 -0.84 0.25 -1.00 0.48 1.00 0.00
1.06 1.00 -0.88 -0.76 0.37 -1.00 0.62 1.00 0.00
1.08 1.00 -0.84 -0.68 0.48 -1.00 0.30 1.00 0.00
1.10 1.00 -0.80 -0.60 0.59 -1.00 0.77 1.00 0.00
1.12 1.00 -0.76 -0.52 0.68 -1.00 0.01 1.00 0.00
1.14 1.00 -0.72 -0.44 0.77 -0.71 0.33 1.00 0.00
1.16 1.00 -0.68 -0.36 0.84 -0.71 0.67 1.00 0.00
1.18 1.00 -0.64 -0.28 0.90 -0.71 0.13 1.00 0.00
1.20 1.00 -0.60 -0.20 0.95 -0.71 0.10 1.00 0.00
1.22 1.00 -0.56 -0.12 0.98 -0.71 0.95 1.00 0.00
1.24 1.00 -0.52 -0.04 1.00 -0.71 0.44 1.00 0.00
1.26 1.00 -0.48 0.04 1.00 -0.43 0.64 1.00 0.00
1.28 1.00 -0.44 0.12 0.98 -0.43 0.03 1.00 0.00
1.30 1.00 -0.40 0.20 0.95 -0.43 0.10 1.00 0.00
1.32 1.00 -0.36 0.28 0.90 -0.43 0.05 1.00 0.00
1.34 1.00 -0.32 0.36 0.84 -0.43 0.42 1.00 0.00
1.36 1.00 -0.28 0.44 0.77 -0.43 0.99 1.00 0.00
1.38 1.00 -0.24 0.52 0.68 -0.14 0.04 1.00 0.00
1.40 1.00 -0.20 0.60 0.59 -0.14 0.98 1.00 0.00
1.42 1.00 -0.16 0.68 0.48 -0.14 0.17 1.00 0.00
1.44 1.00 -0.12 0.76 0.37 -0.14 0.47 1.00 0.00
1.46 1.00 -0.08 0.84 0.25 -0.14 0.58 1.00 0.00
1.48 1.00 -0.04 0.92 0.13 -0.14 0.62 1.00 0.00
1.50 -1.00 0.00 1.00 -0.00 0.14 0.63 1.00 0.00
1.52 -1.00 0.04 0.92 -0.13 0.14 0.74 1.00 0.00
1.54 -1.00 0.08 0.84 -0.25 0.14 0.22 1.00 0.00
1.56 -1.00 0.12 0.76 -0.37 0.14 0.29 1.00 0.00
1.58 -1.00 0.16 0.68 -0.48 0.14 0.57 1.00 0.00
1.60 -1.00 0.20 0.60 -0.59 0.14 0.86 1.00 0.00
1.62 -1.00 0.24 0.52 -0.68 0.14 0.66 1.00 0.00
1.64 -1.00 0.28 0.44 -0.77 0.43 0.79 1.00 0.00
1.66 -1.00 0.32 0.36 -0.84 0.43 0.73 1.00 0.00
1.68 -1.00 0.36 0.28 -0.90 0.43 0.90 1.00 0.00
1.70 -1.00 0.40 0.20 -0.95 0.43 0.15 1.00 0.00
1.72 -1.00 0.44 0.12 -0.98 0.43 0.24 1.00 0.00
1.74 -1.00 0.48 0.04 -1.00 0.43 0.86 1.00 0.00
1.76 -1.00 0.52 -0.04 -1.00 0.71 0.35 1.00 0.00
1.78 -1.00 0.56 -0.12 -0.98 0.71 0.50 1.00 0.00
1.80 -1.00 0.60 -0.20 -0.95 0.71 0.55 1.00 0.00
1.82 -1.00 0.64 -0.28 -0.90 0.71 0.37 1.00 0.00
1.84 -1.00 0.68 -0.36 -0.84 0.71 0.88 1.00 0.00
1.86 -1.00 0.72 -0.44 -0.77 0.71 0.50 1.00 0.00
1.88 -1.00 0.76 -0.52 -0.68 1.00 0.08 1.00 0.00
1.90 -1.00 0.80 -0.60 -0.59 1.00 0.74 1.00 0.00
1.92 -1.00 0.84 -0.68 -0.48 1.00 0.26 1.00 0.00
1.94 -1.00 0.88 -0.76 -0.37 1.00 0.58 1.00 0.00
1.96 -1.00 0.92 -0.84 -0.25 1.00 0.38 1.00 0.00
1.98 -1.00 0.96 -0.92 -0.13 1.00 0.87 1.00 0.00
2.00 1.00 -1.00 -1.00 0.00 -1.00 0.77 1.00 0.00
2.02 1.00 -0.96 -0.92 0.13 -1.00 0.66 1.00 0.00
2.04 1.00 -0.92 -0.84 0.25 -1.00 0.71 1.00 0.00
2.06 1.00 -0.88 -0.76 0.37 -1.00 0.99 1.00 0.00
2.08 1.00 -0.84 -0.68 0.48 -1.00 0.41 1.00 0.00
2.10 1.00 -0.80 -0.60 0.59 -1.00 0.73 1.00 0.00
2.12 1.00 -0.76 -0.52 0.68 -1.00 0.62 1.00 0.00
2.14 1.00 -0.72 -0.44 0.77 -0.71 0.44 1.00 0.00
2.16 1.00 -0.68 -0.36 0.84 -0.71 0.47 1.00 0.00
2.18 1.00 -0.64 -0.28 0.90 -0.71 0.83 1.00 0.00
2.20 1.00 -0.60 -0.20 0.95 -0.71 0.64 1.00 0.00
2.22 1.00 -0.56 -0.12 0.98 -0.71 0.81 1.00 0.00
2.24 1.00 -0.52 -0.04 1.00 -0.71 0.62 1.00 0.00
2.26 1.00 -0.48 0.04 1.00 -0.43 0.77 1.00 0.00
2.28 1.00 -0.44 0.12 0.98 -0.43 0.32 1.00 0.00
2.30 1.00 -0.40 0.20 0.95 -0.43 0.18 1.00 0.00
2.32 1.00 -0.36 0.28 0.90 -0.43 0.22 1.00 0.00
2.34 1.00 -0.32 0.36 0.84 -0.43 0.78 1.00 0.00
2.36 1.00 -0.28 0.44 0.77 -0.43 0.87 1.00 0.00
2.38 1.00 -0.24 0.52 0.68 -0.14 0.43 1.00 0.00
2.40 1.00 -0.20 0.60 0.59 -0.14 0.05 1.00 0.00
2.42 1.00 -0.16 0.68 0.48 -0.14 0.87 1.00 0.00
2.44 1.00 -0.12 0.76 0.37 -0.14 0.12 1.00 0.00
2.46 1.00 -0.08 0.84 0.25 -0.14 0.86 1.00 0.00
2.48 1.00 -0.04 0.92 0.13 -0.14 0.45 1.00 0.00
2.50 -1.00 0.00 1.00 -0.00 0.14 0.15 1.00 0.00
2.52 -1.00 0.04 0.92 -0.13 0.14 0.92 1.00 0.00
2.54 -1.00 0.08 0.84 -0.25 0.14 0.38 1.00 0.00
2.56 -1.00 0.12 0.76 -0.37 0.14 0.70 1.00 0.00
2.58 -1.00 0.16 0.68 -0.48 0.14 0.82 1.00 0.00
2.60 -1.00 0.20 0.60 -0.59 0.14 0.57 1.00 0.00
2.62 -1.00 0.24 0.52 -0.68 0.14 0.71 1.00 0.00
2.64 -1.00 0.28 0.44 -0.77 0.43 0.31 1.00 0.00
2.66 -1.00 0.32 0.36 -0.84 0.43 0.23 1.00 0.00
2.68 -1.00 0.36 0.28 -0.90 0.43 0.97 1.00 0.00
2.70 -1.00 0.40 0.20 -0.95 0.43 0.86 1.00 0.00
2.72 -1.00 0.44 0.12 -0.98 0.43 0.41 1.00 0.00
2.74 -1.00 0.48 0.04 -1.00 0.43 0.57 1.00 0.00
2.76 -1.00 0.52 -0.04 -1.00 0.71 0.06 1.00 0.00
2.78 -1.00 0.56 -0.12 -0.98 0.71 0.19 1.00 0.00
2.80 -1.00 0.60 -0.20 -0.95 0.71 0.09 1.00 0.00
2.82 -1.00 0.64 -0.28 -0.90 0.71 0.46 1.00 0.00
2.84 -1.00 0.68 -0.36 -0.84 0.71 0.06 1.00 0.00
2.86 -1.00 0.72 -0.44 -0.77 0.71 0.86 1.00 0.00
2.88 -1.00 0.76 -0.52 -0.68 1.00 0.54 1.00 0.00
2.90 -1.00 0.80 -0.60 -0.59 1.00 0.42 1.00 0.00
2.92 -1.00 0.84 -0.68 -0.48 1.00 0.08 1.00 0.00
2.94 -1.00 0.88 -0.76 -0.37 1.00 0.76 1.00 0.00
2.96 -1.00 0.92 -0.84 -0.25 1.00 0.91 1.00 0.00
2.98 -1.00 0.96 -0.92 -0.13 1.00 0.55 1.00 0.00
3.00 1.00 -1.00 -1.00 0.00 -1.00 0.46 1.00 0.00
3.02 1.00 -0.96 -0.92 0.13 -1.00 0.82 1.00 0.00
3.04 1.00 -0.92 -0.84 0.25 -1.00 0.59 1.00 0.00
3.06 1.00 -0.88 -0.76 0.37 -1.00 0.29 1.00 0.00
3.08 1.00 -0.84 -0.68 0.48 -1.00 0.42 1.00 0.00
3.10 1.00 -0.80 -0.60 0.59 -1.00 0.29 1.00 0.00
3.12 1.00 -0.76 -0.52 0.68 -1.00 0.51 1.00 0.00
3.14 1.00 -0.72 -0.44 0.77 -0.71 0.58 1.00 0.00
3.16 1.00 -0.68 -0.36 0.84 -0.71 0.16 1.00 0.00
3.18 1.00 -0.64 -0.28 0.90 -0.71 0.86 1.00 0.00
3.20 1.00 -0.60 -0.20 0.95 -0.71 0.04 1.00 0.00
3.22 1.00 -0.56 -0.12 0.98 -0.71 0.59 1.00 0.00
3.24 1.00 -0.52 -0.04 1.00 -0.71 0.14 1.00 0.00
3.26 1.00 -0.48 0.04 1.00 -0.43 0.48 1.00 0.00
3.28 1.00 -0.44 0.12 0.98 -0.43 0.65 1.00 0.00
3.30 1.00 -0.40 0.20 0.95 -0.43 0.54 1.00 0.00
3.32 1.00 -0.36 0.28 0.90 -0.43 0.72 1.00 0.00
3.34 1.00 -0.32 0.36 0.84 -0.43 0.66 1.00 0.00
3.36 1.00 -0.28 0.44 0.77 -0.43 0.66 1.00 0.00
3.38 1.00 -0.24 0.52 0.68 -0.14 0.66 1.00 0.00
3.40 1.00 -0.20 0.60 0.59 -0.14 0.81 1.00 0.00
3.42 1.00 -0.16 0.68 0.48 -0.14 0.09 1.00 0.00
3.44 1.00 -0.12 0.76 0.37 -0.14 0.01 1.00 0.00
3.46 1.00 -0.08 0.84 0.25 -0.14 0.70 1.00 0.00
3.48 1.00 -0.04 0.92 0.13 -0.14 0.29 1.00 0.00
3.50 -1.00 0.00 1.00 -0.00 0.14 0.39 1.00 0.00
3.52 -1.00 0.04 0.92 -0.13 0.14 0.60 1.00 0.00
3.54 -1.00 0.08 0.84 -0.25 0.14 0.04 1.00 0.00
3.56 -1.00 0.12 0.76 -0.37 0.14 0.51 1.00 0.00
3.58 -1.00 0.16 0.68 -0.48 0.14 0.61 1.00 0.00
3.60 -1.00 0.20 0.60 -0.59 0.14 0.19 1.00 0.00
3.62 -1.00 0.24 0.52 -0.68 0.14 0.99 1.00 0.00
3.64 -1.00 0.28 0.44 -0.77 0.43 0.69 1.00 0.00
3.66 -1.00 0.32 0.36 -0.84 0.43 0.83 1.00 0.00
3.68 -1.00 0.36 0.28 -0.90 0.43 0.63 1.00 0.00
3.70 -1.00 0.40 0.20 -0.95 0.43 0.71 1.00 0.00
3.72 -1.00 0.44 0.12 -0.98 0.43 0.84 1.00 0.00
3.74 -1.00 0.48 0.04 -1.00 0.43 0.60 1.00 0.00
3.76 -1.00 0.52 -0.04 -1.00 0.71 0.07 1.00 0.00
3.78 -1.00 0.56 -0.12 -0.98 0.71 0.62 1.00 0.00
3.80 -1.00 0.60 -0.20 -0.95 0.71 0.40 1.00 0.00
3.82 -1.00 0.64 -0.28 -0.90 0.71 0.82 1.00 0.00
3.84 -1.00 0.68 -0.36 -0.84 0.71 0.69 1.00 0.00
3.86 -1.00 0.72 -0.44 -0.77 0.71 0.57 1.00 0.00
3.88 -1.00 0.76 -0.52 -0.68 1.00 0.99 1.00 0.00
3.90 -1.00 0.80 -0.60 -0.59 1.00 0.27 1.00 0.00
3.92 -1.00 0.84 -0.68 -0.48 1.00 0.28 1.00 0.00
3.94 -1.00 0.88 -0.76 -0.37 1.00 0.49 1.00 0.00
3.96 -1.00 0.92 -0.84 -0.25 1.00 0.86 1.00 0.00
3.98 -1.00 0.96 -0.92 -0.13 1.00 0.39 1.00 0.00
done...

View File

@ -0,0 +1,415 @@
Start functionGeneratorPerformance - LIB VERSION: 0.2.5
func usec max calls/sec
test_square: 55.20 18116.73
test_sawtooth: 62.32 16047.04
test_triangle: 80.42 12434.10
test_sinus: 164.87 6065.36
test_stair: 81.49 12271.02
test_random: 43.18 23159.08
test_random_DC: 67.75 14760.93
test_line: 0.76 1322751.37
test_zero: 0.75 1325556.75
t sqr saw tri sin str rnd line zero
-4.00 -1.00 1.00 -1.00 -0.00 1.00 0.50 1.00 0.00
-3.98 1.00 -0.96 -0.92 0.13 -1.00 0.06 1.00 0.00
-3.96 1.00 -0.92 -0.84 0.25 -1.00 0.34 1.00 0.00
-3.94 1.00 -0.88 -0.76 0.37 -1.00 0.33 1.00 0.00
-3.92 1.00 -0.84 -0.68 0.48 -1.00 0.95 1.00 0.00
-3.90 1.00 -0.80 -0.60 0.59 -1.00 0.75 1.00 0.00
-3.88 1.00 -0.76 -0.52 0.68 -1.00 0.20 1.00 0.00
-3.86 1.00 -0.72 -0.44 0.77 -0.71 0.33 1.00 0.00
-3.84 1.00 -0.68 -0.36 0.84 -0.71 0.25 1.00 0.00
-3.82 1.00 -0.64 -0.28 0.90 -0.71 0.39 1.00 0.00
-3.80 1.00 -0.60 -0.20 0.95 -0.71 0.42 1.00 0.00
-3.78 1.00 -0.56 -0.12 0.98 -0.71 0.95 1.00 0.00
-3.76 1.00 -0.52 -0.04 1.00 -0.71 0.56 1.00 0.00
-3.74 1.00 -0.48 0.04 1.00 -0.43 0.64 1.00 0.00
-3.72 1.00 -0.44 0.12 0.98 -0.43 0.17 1.00 0.00
-3.70 1.00 -0.40 0.20 0.95 -0.43 0.78 1.00 0.00
-3.68 1.00 -0.36 0.28 0.90 -0.43 0.02 1.00 0.00
-3.66 1.00 -0.32 0.36 0.84 -0.43 0.31 1.00 0.00
-3.64 1.00 -0.28 0.44 0.77 -0.43 0.49 1.00 0.00
-3.62 1.00 -0.24 0.52 0.68 -0.14 0.09 1.00 0.00
-3.60 1.00 -0.20 0.60 0.59 -0.14 0.21 1.00 0.00
-3.58 1.00 -0.16 0.68 0.48 -0.14 0.82 1.00 0.00
-3.56 1.00 -0.12 0.76 0.37 -0.14 0.51 1.00 0.00
-3.54 1.00 -0.08 0.84 0.25 -0.14 0.74 1.00 0.00
-3.52 1.00 -0.04 0.92 0.13 -0.14 0.20 1.00 0.00
-3.50 1.00 0.00 1.00 0.00 -0.14 0.27 1.00 0.00
-3.48 -1.00 0.04 0.92 -0.13 0.14 0.15 1.00 0.00
-3.46 -1.00 0.08 0.84 -0.25 0.14 0.67 1.00 0.00
-3.44 -1.00 0.12 0.76 -0.37 0.14 0.54 1.00 0.00
-3.42 -1.00 0.16 0.68 -0.48 0.14 0.44 1.00 0.00
-3.40 -1.00 0.20 0.60 -0.59 0.14 0.85 1.00 0.00
-3.38 -1.00 0.24 0.52 -0.68 0.14 0.90 1.00 0.00
-3.36 -1.00 0.28 0.44 -0.77 0.43 0.43 1.00 0.00
-3.34 -1.00 0.32 0.36 -0.84 0.43 0.11 1.00 0.00
-3.32 -1.00 0.36 0.28 -0.90 0.43 0.91 1.00 0.00
-3.30 -1.00 0.40 0.20 -0.95 0.43 0.79 1.00 0.00
-3.28 -1.00 0.44 0.12 -0.98 0.43 0.17 1.00 0.00
-3.26 -1.00 0.48 0.04 -1.00 0.43 0.72 1.00 0.00
-3.24 -1.00 0.52 -0.04 -1.00 0.71 0.77 1.00 0.00
-3.22 -1.00 0.56 -0.12 -0.98 0.71 0.86 1.00 0.00
-3.20 -1.00 0.60 -0.20 -0.95 0.71 0.50 1.00 0.00
-3.18 -1.00 0.64 -0.28 -0.90 0.71 0.42 1.00 0.00
-3.16 -1.00 0.68 -0.36 -0.84 0.71 0.73 1.00 0.00
-3.14 -1.00 0.72 -0.44 -0.77 0.71 0.01 1.00 0.00
-3.12 -1.00 0.76 -0.52 -0.68 1.00 0.52 1.00 0.00
-3.10 -1.00 0.80 -0.60 -0.59 1.00 0.72 1.00 0.00
-3.08 -1.00 0.84 -0.68 -0.48 1.00 0.61 1.00 0.00
-3.06 -1.00 0.88 -0.76 -0.37 1.00 0.41 1.00 0.00
-3.04 -1.00 0.92 -0.84 -0.25 1.00 0.68 1.00 0.00
-3.02 -1.00 0.96 -0.92 -0.13 1.00 0.34 1.00 0.00
-3.00 -1.00 1.00 -1.00 -0.00 1.00 0.90 1.00 0.00
-2.98 1.00 -0.96 -0.92 0.13 -1.00 0.43 1.00 0.00
-2.96 1.00 -0.92 -0.84 0.25 -1.00 0.47 1.00 0.00
-2.94 1.00 -0.88 -0.76 0.37 -1.00 0.51 1.00 0.00
-2.92 1.00 -0.84 -0.68 0.48 -1.00 0.29 1.00 0.00
-2.90 1.00 -0.80 -0.60 0.59 -1.00 0.42 1.00 0.00
-2.88 1.00 -0.76 -0.52 0.68 -1.00 0.02 1.00 0.00
-2.86 1.00 -0.72 -0.44 0.77 -0.71 0.91 1.00 0.00
-2.84 1.00 -0.68 -0.36 0.84 -0.71 0.00 1.00 0.00
-2.82 1.00 -0.64 -0.28 0.90 -0.71 0.22 1.00 0.00
-2.80 1.00 -0.60 -0.20 0.95 -0.71 0.55 1.00 0.00
-2.78 1.00 -0.56 -0.12 0.98 -0.71 0.96 1.00 0.00
-2.76 1.00 -0.52 -0.04 1.00 -0.71 0.30 1.00 0.00
-2.74 1.00 -0.48 0.04 1.00 -0.43 0.19 1.00 0.00
-2.72 1.00 -0.44 0.12 0.98 -0.43 0.62 1.00 0.00
-2.70 1.00 -0.40 0.20 0.95 -0.43 0.61 1.00 0.00
-2.68 1.00 -0.36 0.28 0.90 -0.43 0.28 1.00 0.00
-2.66 1.00 -0.32 0.36 0.84 -0.43 0.85 1.00 0.00
-2.64 1.00 -0.28 0.44 0.77 -0.43 0.22 1.00 0.00
-2.62 1.00 -0.24 0.52 0.68 -0.14 0.66 1.00 0.00
-2.60 1.00 -0.20 0.60 0.59 -0.14 0.62 1.00 0.00
-2.58 1.00 -0.16 0.68 0.48 -0.14 0.30 1.00 0.00
-2.56 1.00 -0.12 0.76 0.37 -0.14 0.38 1.00 0.00
-2.54 1.00 -0.08 0.84 0.25 -0.14 0.00 1.00 0.00
-2.52 1.00 -0.04 0.92 0.13 -0.14 0.09 1.00 0.00
-2.50 1.00 0.00 1.00 0.00 -0.14 0.56 1.00 0.00
-2.48 -1.00 0.04 0.92 -0.13 0.14 0.67 1.00 0.00
-2.46 -1.00 0.08 0.84 -0.25 0.14 0.66 1.00 0.00
-2.44 -1.00 0.12 0.76 -0.37 0.14 0.15 1.00 0.00
-2.42 -1.00 0.16 0.68 -0.48 0.14 0.71 1.00 0.00
-2.40 -1.00 0.20 0.60 -0.59 0.14 0.75 1.00 0.00
-2.38 -1.00 0.24 0.52 -0.68 0.14 0.13 1.00 0.00
-2.36 -1.00 0.28 0.44 -0.77 0.43 0.99 1.00 0.00
-2.34 -1.00 0.32 0.36 -0.84 0.43 0.01 1.00 0.00
-2.32 -1.00 0.36 0.28 -0.90 0.43 0.92 1.00 0.00
-2.30 -1.00 0.40 0.20 -0.95 0.43 0.92 1.00 0.00
-2.28 -1.00 0.44 0.12 -0.98 0.43 0.38 1.00 0.00
-2.26 -1.00 0.48 0.04 -1.00 0.43 0.87 1.00 0.00
-2.24 -1.00 0.52 -0.04 -1.00 0.71 0.42 1.00 0.00
-2.22 -1.00 0.56 -0.12 -0.98 0.71 0.88 1.00 0.00
-2.20 -1.00 0.60 -0.20 -0.95 0.71 0.71 1.00 0.00
-2.18 -1.00 0.64 -0.28 -0.90 0.71 0.97 1.00 0.00
-2.16 -1.00 0.68 -0.36 -0.84 0.71 0.27 1.00 0.00
-2.14 -1.00 0.72 -0.44 -0.77 0.71 0.94 1.00 0.00
-2.12 -1.00 0.76 -0.52 -0.68 1.00 0.92 1.00 0.00
-2.10 -1.00 0.80 -0.60 -0.59 1.00 0.02 1.00 0.00
-2.08 -1.00 0.84 -0.68 -0.48 1.00 0.26 1.00 0.00
-2.06 -1.00 0.88 -0.76 -0.37 1.00 0.54 1.00 0.00
-2.04 -1.00 0.92 -0.84 -0.25 1.00 0.93 1.00 0.00
-2.02 -1.00 0.96 -0.92 -0.13 1.00 0.25 1.00 0.00
-2.00 -1.00 1.00 -1.00 -0.00 1.00 0.77 1.00 0.00
-1.98 1.00 -0.96 -0.92 0.13 -1.00 0.71 1.00 0.00
-1.96 1.00 -0.92 -0.84 0.25 -1.00 0.86 1.00 0.00
-1.94 1.00 -0.88 -0.76 0.37 -1.00 0.15 1.00 0.00
-1.92 1.00 -0.84 -0.68 0.48 -1.00 0.80 1.00 0.00
-1.90 1.00 -0.80 -0.60 0.59 -1.00 0.17 1.00 0.00
-1.88 1.00 -0.76 -0.52 0.68 -1.00 0.18 1.00 0.00
-1.86 1.00 -0.72 -0.44 0.77 -0.71 0.54 1.00 0.00
-1.84 1.00 -0.68 -0.36 0.84 -0.71 0.13 1.00 0.00
-1.82 1.00 -0.64 -0.28 0.90 -0.71 0.71 1.00 0.00
-1.80 1.00 -0.60 -0.20 0.95 -0.71 0.24 1.00 0.00
-1.78 1.00 -0.56 -0.12 0.98 -0.71 0.73 1.00 0.00
-1.76 1.00 -0.52 -0.04 1.00 -0.71 0.08 1.00 0.00
-1.74 1.00 -0.48 0.04 1.00 -0.43 0.13 1.00 0.00
-1.72 1.00 -0.44 0.12 0.98 -0.43 0.28 1.00 0.00
-1.70 1.00 -0.40 0.20 0.95 -0.43 0.20 1.00 0.00
-1.68 1.00 -0.36 0.28 0.90 -0.43 0.53 1.00 0.00
-1.66 1.00 -0.32 0.36 0.84 -0.43 0.48 1.00 0.00
-1.64 1.00 -0.28 0.44 0.77 -0.43 0.38 1.00 0.00
-1.62 1.00 -0.24 0.52 0.68 -0.14 0.28 1.00 0.00
-1.60 1.00 -0.20 0.60 0.59 -0.14 0.06 1.00 0.00
-1.58 1.00 -0.16 0.68 0.48 -0.14 0.84 1.00 0.00
-1.56 1.00 -0.12 0.76 0.37 -0.14 0.35 1.00 0.00
-1.54 1.00 -0.08 0.84 0.25 -0.14 0.13 1.00 0.00
-1.52 1.00 -0.04 0.92 0.13 -0.14 0.51 1.00 0.00
-1.50 1.00 0.00 1.00 0.00 -0.14 0.37 1.00 0.00
-1.48 -1.00 0.04 0.92 -0.13 0.14 0.40 1.00 0.00
-1.46 -1.00 0.08 0.84 -0.25 0.14 0.26 1.00 0.00
-1.44 -1.00 0.12 0.76 -0.37 0.14 0.30 1.00 0.00
-1.42 -1.00 0.16 0.68 -0.48 0.14 0.76 1.00 0.00
-1.40 -1.00 0.20 0.60 -0.59 0.14 0.59 1.00 0.00
-1.38 -1.00 0.24 0.52 -0.68 0.14 0.32 1.00 0.00
-1.36 -1.00 0.28 0.44 -0.77 0.43 0.79 1.00 0.00
-1.34 -1.00 0.32 0.36 -0.84 0.43 0.63 1.00 0.00
-1.32 -1.00 0.36 0.28 -0.90 0.43 0.20 1.00 0.00
-1.30 -1.00 0.40 0.20 -0.95 0.43 0.83 1.00 0.00
-1.28 -1.00 0.44 0.12 -0.98 0.43 0.25 1.00 0.00
-1.26 -1.00 0.48 0.04 -1.00 0.43 0.36 1.00 0.00
-1.24 -1.00 0.52 -0.04 -1.00 0.71 0.25 1.00 0.00
-1.22 -1.00 0.56 -0.12 -0.98 0.71 0.25 1.00 0.00
-1.20 -1.00 0.60 -0.20 -0.95 0.71 0.18 1.00 0.00
-1.18 -1.00 0.64 -0.28 -0.90 0.71 0.30 1.00 0.00
-1.16 -1.00 0.68 -0.36 -0.84 0.71 0.09 1.00 0.00
-1.14 -1.00 0.72 -0.44 -0.77 0.71 0.32 1.00 0.00
-1.12 -1.00 0.76 -0.52 -0.68 1.00 0.69 1.00 0.00
-1.10 -1.00 0.80 -0.60 -0.59 1.00 0.96 1.00 0.00
-1.08 -1.00 0.84 -0.68 -0.48 1.00 0.28 1.00 0.00
-1.06 -1.00 0.88 -0.76 -0.37 1.00 0.93 1.00 0.00
-1.04 -1.00 0.92 -0.84 -0.25 1.00 0.21 1.00 0.00
-1.02 -1.00 0.96 -0.92 -0.13 1.00 0.87 1.00 0.00
-1.00 -1.00 1.00 -1.00 -0.00 1.00 0.57 1.00 0.00
-0.98 1.00 -0.96 -0.92 0.13 -1.00 0.42 1.00 0.00
-0.96 1.00 -0.92 -0.84 0.25 -1.00 0.81 1.00 0.00
-0.94 1.00 -0.88 -0.76 0.37 -1.00 0.39 1.00 0.00
-0.92 1.00 -0.84 -0.68 0.48 -1.00 0.71 1.00 0.00
-0.90 1.00 -0.80 -0.60 0.59 -1.00 0.47 1.00 0.00
-0.88 1.00 -0.76 -0.52 0.68 -1.00 0.56 1.00 0.00
-0.86 1.00 -0.72 -0.44 0.77 -0.71 0.86 1.00 0.00
-0.84 1.00 -0.68 -0.36 0.84 -0.71 0.87 1.00 0.00
-0.82 1.00 -0.64 -0.28 0.90 -0.71 0.43 1.00 0.00
-0.80 1.00 -0.60 -0.20 0.95 -0.71 0.42 1.00 0.00
-0.78 1.00 -0.56 -0.12 0.98 -0.71 0.60 1.00 0.00
-0.76 1.00 -0.52 -0.04 1.00 -0.71 0.13 1.00 0.00
-0.74 1.00 -0.48 0.04 1.00 -0.43 0.04 1.00 0.00
-0.72 1.00 -0.44 0.12 0.98 -0.43 0.30 1.00 0.00
-0.70 1.00 -0.40 0.20 0.95 -0.43 0.84 1.00 0.00
-0.68 1.00 -0.36 0.28 0.90 -0.43 0.52 1.00 0.00
-0.66 1.00 -0.32 0.36 0.84 -0.43 0.25 1.00 0.00
-0.64 1.00 -0.28 0.44 0.77 -0.43 0.04 1.00 0.00
-0.62 1.00 -0.24 0.52 0.68 -0.14 0.38 1.00 0.00
-0.60 1.00 -0.20 0.60 0.59 -0.14 0.46 1.00 0.00
-0.58 1.00 -0.16 0.68 0.48 -0.14 0.66 1.00 0.00
-0.56 1.00 -0.12 0.76 0.37 -0.14 0.55 1.00 0.00
-0.54 1.00 -0.08 0.84 0.25 -0.14 0.84 1.00 0.00
-0.52 1.00 -0.04 0.92 0.13 -0.14 0.66 1.00 0.00
-0.50 1.00 0.00 1.00 0.00 -0.14 0.97 1.00 0.00
-0.48 -1.00 0.04 0.92 -0.13 0.14 0.94 1.00 0.00
-0.46 -1.00 0.08 0.84 -0.25 0.14 0.18 1.00 0.00
-0.44 -1.00 0.12 0.76 -0.37 0.14 0.27 1.00 0.00
-0.42 -1.00 0.16 0.68 -0.48 0.14 0.62 1.00 0.00
-0.40 -1.00 0.20 0.60 -0.59 0.14 0.22 1.00 0.00
-0.38 -1.00 0.24 0.52 -0.68 0.14 0.12 1.00 0.00
-0.36 -1.00 0.28 0.44 -0.77 0.43 0.51 1.00 0.00
-0.34 -1.00 0.32 0.36 -0.84 0.43 0.54 1.00 0.00
-0.32 -1.00 0.36 0.28 -0.90 0.43 0.36 1.00 0.00
-0.30 -1.00 0.40 0.20 -0.95 0.43 0.19 1.00 0.00
-0.28 -1.00 0.44 0.12 -0.98 0.43 0.73 1.00 0.00
-0.26 -1.00 0.48 0.04 -1.00 0.43 0.58 1.00 0.00
-0.24 -1.00 0.52 -0.04 -1.00 0.71 0.74 1.00 0.00
-0.22 -1.00 0.56 -0.12 -0.98 0.71 0.48 1.00 0.00
-0.20 -1.00 0.60 -0.20 -0.95 0.71 0.37 1.00 0.00
-0.18 -1.00 0.64 -0.28 -0.90 0.71 0.49 1.00 0.00
-0.16 -1.00 0.68 -0.36 -0.84 0.71 0.99 1.00 0.00
-0.14 -1.00 0.72 -0.44 -0.77 0.71 0.38 1.00 0.00
-0.12 -1.00 0.76 -0.52 -0.68 1.00 0.16 1.00 0.00
-0.10 -1.00 0.80 -0.60 -0.59 1.00 0.20 1.00 0.00
-0.08 -1.00 0.84 -0.68 -0.48 1.00 0.36 1.00 0.00
-0.06 -1.00 0.88 -0.76 -0.37 1.00 0.93 1.00 0.00
-0.04 -1.00 0.92 -0.84 -0.25 1.00 0.31 1.00 0.00
-0.02 -1.00 0.96 -0.92 -0.13 1.00 0.71 1.00 0.00
0.00 1.00 -1.00 -1.00 0.00 -1.00 0.35 1.00 0.00
0.02 1.00 -0.96 -0.92 0.13 -1.00 0.58 1.00 0.00
0.04 1.00 -0.92 -0.84 0.25 -1.00 0.38 1.00 0.00
0.06 1.00 -0.88 -0.76 0.37 -1.00 0.45 1.00 0.00
0.08 1.00 -0.84 -0.68 0.48 -1.00 0.96 1.00 0.00
0.10 1.00 -0.80 -0.60 0.59 -1.00 0.00 1.00 0.00
0.12 1.00 -0.76 -0.52 0.68 -1.00 0.59 1.00 0.00
0.14 1.00 -0.72 -0.44 0.77 -0.71 0.09 1.00 0.00
0.16 1.00 -0.68 -0.36 0.84 -0.71 0.93 1.00 0.00
0.18 1.00 -0.64 -0.28 0.90 -0.71 0.17 1.00 0.00
0.20 1.00 -0.60 -0.20 0.95 -0.71 0.32 1.00 0.00
0.22 1.00 -0.56 -0.12 0.98 -0.71 0.18 1.00 0.00
0.24 1.00 -0.52 -0.04 1.00 -0.71 0.87 1.00 0.00
0.26 1.00 -0.48 0.04 1.00 -0.43 0.67 1.00 0.00
0.28 1.00 -0.44 0.12 0.98 -0.43 0.22 1.00 0.00
0.30 1.00 -0.40 0.20 0.95 -0.43 0.83 1.00 0.00
0.32 1.00 -0.36 0.28 0.90 -0.43 0.65 1.00 0.00
0.34 1.00 -0.32 0.36 0.84 -0.43 0.32 1.00 0.00
0.36 1.00 -0.28 0.44 0.77 -0.43 0.30 1.00 0.00
0.38 1.00 -0.24 0.52 0.68 -0.14 0.90 1.00 0.00
0.40 1.00 -0.20 0.60 0.59 -0.14 0.86 1.00 0.00
0.42 1.00 -0.16 0.68 0.48 -0.14 0.30 1.00 0.00
0.44 1.00 -0.12 0.76 0.37 -0.14 0.68 1.00 0.00
0.46 1.00 -0.08 0.84 0.25 -0.14 0.06 1.00 0.00
0.48 1.00 -0.04 0.92 0.13 -0.14 0.27 1.00 0.00
0.50 -1.00 0.00 1.00 -0.00 0.14 0.00 1.00 0.00
0.52 -1.00 0.04 0.92 -0.13 0.14 0.62 1.00 0.00
0.54 -1.00 0.08 0.84 -0.25 0.14 0.18 1.00 0.00
0.56 -1.00 0.12 0.76 -0.37 0.14 0.13 1.00 0.00
0.58 -1.00 0.16 0.68 -0.48 0.14 0.96 1.00 0.00
0.60 -1.00 0.20 0.60 -0.59 0.14 0.83 1.00 0.00
0.62 -1.00 0.24 0.52 -0.68 0.14 0.11 1.00 0.00
0.64 -1.00 0.28 0.44 -0.77 0.43 0.56 1.00 0.00
0.66 -1.00 0.32 0.36 -0.84 0.43 0.44 1.00 0.00
0.68 -1.00 0.36 0.28 -0.90 0.43 0.05 1.00 0.00
0.70 -1.00 0.40 0.20 -0.95 0.43 0.35 1.00 0.00
0.72 -1.00 0.44 0.12 -0.98 0.43 0.82 1.00 0.00
0.74 -1.00 0.48 0.04 -1.00 0.43 0.71 1.00 0.00
0.76 -1.00 0.52 -0.04 -1.00 0.71 0.26 1.00 0.00
0.78 -1.00 0.56 -0.12 -0.98 0.71 0.79 1.00 0.00
0.80 -1.00 0.60 -0.20 -0.95 0.71 0.63 1.00 0.00
0.82 -1.00 0.64 -0.28 -0.90 0.71 0.54 1.00 0.00
0.84 -1.00 0.68 -0.36 -0.84 0.71 0.34 1.00 0.00
0.86 -1.00 0.72 -0.44 -0.77 0.71 0.59 1.00 0.00
0.88 -1.00 0.76 -0.52 -0.68 1.00 0.43 1.00 0.00
0.90 -1.00 0.80 -0.60 -0.59 1.00 0.24 1.00 0.00
0.92 -1.00 0.84 -0.68 -0.48 1.00 0.94 1.00 0.00
0.94 -1.00 0.88 -0.76 -0.37 1.00 0.54 1.00 0.00
0.96 -1.00 0.92 -0.84 -0.25 1.00 0.77 1.00 0.00
0.98 -1.00 0.96 -0.92 -0.13 1.00 0.43 1.00 0.00
1.00 1.00 -1.00 -1.00 0.00 -1.00 0.16 1.00 0.00
1.02 1.00 -0.96 -0.92 0.13 -1.00 0.44 1.00 0.00
1.04 1.00 -0.92 -0.84 0.25 -1.00 0.76 1.00 0.00
1.06 1.00 -0.88 -0.76 0.37 -1.00 0.54 1.00 0.00
1.08 1.00 -0.84 -0.68 0.48 -1.00 0.52 1.00 0.00
1.10 1.00 -0.80 -0.60 0.59 -1.00 0.56 1.00 0.00
1.12 1.00 -0.76 -0.52 0.68 -1.00 0.25 1.00 0.00
1.14 1.00 -0.72 -0.44 0.77 -0.71 0.80 1.00 0.00
1.16 1.00 -0.68 -0.36 0.84 -0.71 0.02 1.00 0.00
1.18 1.00 -0.64 -0.28 0.90 -0.71 0.85 1.00 0.00
1.20 1.00 -0.60 -0.20 0.95 -0.71 0.13 1.00 0.00
1.22 1.00 -0.56 -0.12 0.98 -0.71 0.05 1.00 0.00
1.24 1.00 -0.52 -0.04 1.00 -0.71 0.93 1.00 0.00
1.26 1.00 -0.48 0.04 1.00 -0.43 0.97 1.00 0.00
1.28 1.00 -0.44 0.12 0.98 -0.43 0.34 1.00 0.00
1.30 1.00 -0.40 0.20 0.95 -0.43 0.57 1.00 0.00
1.32 1.00 -0.36 0.28 0.90 -0.43 0.60 1.00 0.00
1.34 1.00 -0.32 0.36 0.84 -0.43 0.91 1.00 0.00
1.36 1.00 -0.28 0.44 0.77 -0.43 0.96 1.00 0.00
1.38 1.00 -0.24 0.52 0.68 -0.14 0.25 1.00 0.00
1.40 1.00 -0.20 0.60 0.59 -0.14 0.56 1.00 0.00
1.42 1.00 -0.16 0.68 0.48 -0.14 0.06 1.00 0.00
1.44 1.00 -0.12 0.76 0.37 -0.14 0.75 1.00 0.00
1.46 1.00 -0.08 0.84 0.25 -0.14 0.14 1.00 0.00
1.48 1.00 -0.04 0.92 0.13 -0.14 0.92 1.00 0.00
1.50 -1.00 0.00 1.00 -0.00 0.14 0.35 1.00 0.00
1.52 -1.00 0.04 0.92 -0.13 0.14 0.32 1.00 0.00
1.54 -1.00 0.08 0.84 -0.25 0.14 0.50 1.00 0.00
1.56 -1.00 0.12 0.76 -0.37 0.14 0.97 1.00 0.00
1.58 -1.00 0.16 0.68 -0.48 0.14 0.28 1.00 0.00
1.60 -1.00 0.20 0.60 -0.59 0.14 0.43 1.00 0.00
1.62 -1.00 0.24 0.52 -0.68 0.14 0.42 1.00 0.00
1.64 -1.00 0.28 0.44 -0.77 0.43 0.87 1.00 0.00
1.66 -1.00 0.32 0.36 -0.84 0.43 0.20 1.00 0.00
1.68 -1.00 0.36 0.28 -0.90 0.43 0.51 1.00 0.00
1.70 -1.00 0.40 0.20 -0.95 0.43 0.34 1.00 0.00
1.72 -1.00 0.44 0.12 -0.98 0.43 0.26 1.00 0.00
1.74 -1.00 0.48 0.04 -1.00 0.43 0.04 1.00 0.00
1.76 -1.00 0.52 -0.04 -1.00 0.71 0.04 1.00 0.00
1.78 -1.00 0.56 -0.12 -0.98 0.71 0.60 1.00 0.00
1.80 -1.00 0.60 -0.20 -0.95 0.71 0.82 1.00 0.00
1.82 -1.00 0.64 -0.28 -0.90 0.71 0.23 1.00 0.00
1.84 -1.00 0.68 -0.36 -0.84 0.71 0.93 1.00 0.00
1.86 -1.00 0.72 -0.44 -0.77 0.71 0.31 1.00 0.00
1.88 -1.00 0.76 -0.52 -0.68 1.00 0.50 1.00 0.00
1.90 -1.00 0.80 -0.60 -0.59 1.00 0.08 1.00 0.00
1.92 -1.00 0.84 -0.68 -0.48 1.00 0.47 1.00 0.00
1.94 -1.00 0.88 -0.76 -0.37 1.00 0.30 1.00 0.00
1.96 -1.00 0.92 -0.84 -0.25 1.00 0.63 1.00 0.00
1.98 -1.00 0.96 -0.92 -0.13 1.00 0.59 1.00 0.00
2.00 1.00 -1.00 -1.00 0.00 -1.00 0.36 1.00 0.00
2.02 1.00 -0.96 -0.92 0.13 -1.00 0.53 1.00 0.00
2.04 1.00 -0.92 -0.84 0.25 -1.00 0.87 1.00 0.00
2.06 1.00 -0.88 -0.76 0.37 -1.00 0.18 1.00 0.00
2.08 1.00 -0.84 -0.68 0.48 -1.00 0.24 1.00 0.00
2.10 1.00 -0.80 -0.60 0.59 -1.00 0.27 1.00 0.00
2.12 1.00 -0.76 -0.52 0.68 -1.00 0.31 1.00 0.00
2.14 1.00 -0.72 -0.44 0.77 -0.71 0.06 1.00 0.00
2.16 1.00 -0.68 -0.36 0.84 -0.71 0.64 1.00 0.00
2.18 1.00 -0.64 -0.28 0.90 -0.71 0.30 1.00 0.00
2.20 1.00 -0.60 -0.20 0.95 -0.71 0.75 1.00 0.00
2.22 1.00 -0.56 -0.12 0.98 -0.71 0.87 1.00 0.00
2.24 1.00 -0.52 -0.04 1.00 -0.71 0.96 1.00 0.00
2.26 1.00 -0.48 0.04 1.00 -0.43 0.48 1.00 0.00
2.28 1.00 -0.44 0.12 0.98 -0.43 0.54 1.00 0.00
2.30 1.00 -0.40 0.20 0.95 -0.43 0.20 1.00 0.00
2.32 1.00 -0.36 0.28 0.90 -0.43 0.64 1.00 0.00
2.34 1.00 -0.32 0.36 0.84 -0.43 0.72 1.00 0.00
2.36 1.00 -0.28 0.44 0.77 -0.43 0.07 1.00 0.00
2.38 1.00 -0.24 0.52 0.68 -0.14 0.38 1.00 0.00
2.40 1.00 -0.20 0.60 0.59 -0.14 0.51 1.00 0.00
2.42 1.00 -0.16 0.68 0.48 -0.14 0.47 1.00 0.00
2.44 1.00 -0.12 0.76 0.37 -0.14 0.93 1.00 0.00
2.46 1.00 -0.08 0.84 0.25 -0.14 0.13 1.00 0.00
2.48 1.00 -0.04 0.92 0.13 -0.14 0.80 1.00 0.00
2.50 -1.00 0.00 1.00 -0.00 0.14 0.10 1.00 0.00
2.52 -1.00 0.04 0.92 -0.13 0.14 0.61 1.00 0.00
2.54 -1.00 0.08 0.84 -0.25 0.14 0.26 1.00 0.00
2.56 -1.00 0.12 0.76 -0.37 0.14 0.40 1.00 0.00
2.58 -1.00 0.16 0.68 -0.48 0.14 0.90 1.00 0.00
2.60 -1.00 0.20 0.60 -0.59 0.14 0.77 1.00 0.00
2.62 -1.00 0.24 0.52 -0.68 0.14 0.20 1.00 0.00
2.64 -1.00 0.28 0.44 -0.77 0.43 0.54 1.00 0.00
2.66 -1.00 0.32 0.36 -0.84 0.43 0.88 1.00 0.00
2.68 -1.00 0.36 0.28 -0.90 0.43 1.00 1.00 0.00
2.70 -1.00 0.40 0.20 -0.95 0.43 0.38 1.00 0.00
2.72 -1.00 0.44 0.12 -0.98 0.43 0.82 1.00 0.00
2.74 -1.00 0.48 0.04 -1.00 0.43 0.92 1.00 0.00
2.76 -1.00 0.52 -0.04 -1.00 0.71 0.88 1.00 0.00
2.78 -1.00 0.56 -0.12 -0.98 0.71 0.90 1.00 0.00
2.80 -1.00 0.60 -0.20 -0.95 0.71 0.48 1.00 0.00
2.82 -1.00 0.64 -0.28 -0.90 0.71 0.57 1.00 0.00
2.84 -1.00 0.68 -0.36 -0.84 0.71 0.60 1.00 0.00
2.86 -1.00 0.72 -0.44 -0.77 0.71 0.49 1.00 0.00
2.88 -1.00 0.76 -0.52 -0.68 1.00 0.60 1.00 0.00
2.90 -1.00 0.80 -0.60 -0.59 1.00 0.79 1.00 0.00
2.92 -1.00 0.84 -0.68 -0.48 1.00 0.35 1.00 0.00
2.94 -1.00 0.88 -0.76 -0.37 1.00 0.39 1.00 0.00
2.96 -1.00 0.92 -0.84 -0.25 1.00 0.85 1.00 0.00
2.98 -1.00 0.96 -0.92 -0.13 1.00 0.84 1.00 0.00
3.00 1.00 -1.00 -1.00 0.00 -1.00 0.30 1.00 0.00
3.02 1.00 -0.96 -0.92 0.13 -1.00 0.76 1.00 0.00
3.04 1.00 -0.92 -0.84 0.25 -1.00 0.07 1.00 0.00
3.06 1.00 -0.88 -0.76 0.37 -1.00 0.09 1.00 0.00
3.08 1.00 -0.84 -0.68 0.48 -1.00 0.22 1.00 0.00
3.10 1.00 -0.80 -0.60 0.59 -1.00 0.86 1.00 0.00
3.12 1.00 -0.76 -0.52 0.68 -1.00 0.04 1.00 0.00
3.14 1.00 -0.72 -0.44 0.77 -0.71 0.80 1.00 0.00
3.16 1.00 -0.68 -0.36 0.84 -0.71 0.83 1.00 0.00
3.18 1.00 -0.64 -0.28 0.90 -0.71 0.23 1.00 0.00
3.20 1.00 -0.60 -0.20 0.95 -0.71 0.49 1.00 0.00
3.22 1.00 -0.56 -0.12 0.98 -0.71 0.77 1.00 0.00
3.24 1.00 -0.52 -0.04 1.00 -0.71 0.78 1.00 0.00
3.26 1.00 -0.48 0.04 1.00 -0.43 0.35 1.00 0.00
3.28 1.00 -0.44 0.12 0.98 -0.43 0.99 1.00 0.00
3.30 1.00 -0.40 0.20 0.95 -0.43 0.14 1.00 0.00
3.32 1.00 -0.36 0.28 0.90 -0.43 0.05 1.00 0.00
3.34 1.00 -0.32 0.36 0.84 -0.43 0.70 1.00 0.00
3.36 1.00 -0.28 0.44 0.77 -0.43 0.82 1.00 0.00
3.38 1.00 -0.24 0.52 0.68 -0.14 0.62 1.00 0.00
3.40 1.00 -0.20 0.60 0.59 -0.14 0.01 1.00 0.00
3.42 1.00 -0.16 0.68 0.48 -0.14 0.69 1.00 0.00
3.44 1.00 -0.12 0.76 0.37 -0.14 0.19 1.00 0.00
3.46 1.00 -0.08 0.84 0.25 -0.14 0.39 1.00 0.00
3.48 1.00 -0.04 0.92 0.13 -0.14 0.39 1.00 0.00
3.50 -1.00 0.00 1.00 -0.00 0.14 0.46 1.00 0.00
3.52 -1.00 0.04 0.92 -0.13 0.14 0.75 1.00 0.00
3.54 -1.00 0.08 0.84 -0.25 0.14 0.21 1.00 0.00
3.56 -1.00 0.12 0.76 -0.37 0.14 0.85 1.00 0.00
3.58 -1.00 0.16 0.68 -0.48 0.14 0.92 1.00 0.00
3.60 -1.00 0.20 0.60 -0.59 0.14 0.78 1.00 0.00
3.62 -1.00 0.24 0.52 -0.68 0.14 0.41 1.00 0.00
3.64 -1.00 0.28 0.44 -0.77 0.43 0.90 1.00 0.00
3.66 -1.00 0.32 0.36 -0.84 0.43 0.71 1.00 0.00
3.68 -1.00 0.36 0.28 -0.90 0.43 0.94 1.00 0.00
3.70 -1.00 0.40 0.20 -0.95 0.43 0.92 1.00 0.00
3.72 -1.00 0.44 0.12 -0.98 0.43 0.91 1.00 0.00
3.74 -1.00 0.48 0.04 -1.00 0.43 0.79 1.00 0.00
3.76 -1.00 0.52 -0.04 -1.00 0.71 0.64 1.00 0.00
3.78 -1.00 0.56 -0.12 -0.98 0.71 0.08 1.00 0.00
3.80 -1.00 0.60 -0.20 -0.95 0.71 0.49 1.00 0.00
3.82 -1.00 0.64 -0.28 -0.90 0.71 0.50 1.00 0.00
3.84 -1.00 0.68 -0.36 -0.84 0.71 0.86 1.00 0.00
3.86 -1.00 0.72 -0.44 -0.77 0.71 0.61 1.00 0.00
3.88 -1.00 0.76 -0.52 -0.68 1.00 0.42 1.00 0.00
3.90 -1.00 0.80 -0.60 -0.59 1.00 0.25 1.00 0.00
3.92 -1.00 0.84 -0.68 -0.48 1.00 0.06 1.00 0.00
3.94 -1.00 0.88 -0.76 -0.37 1.00 0.97 1.00 0.00
3.96 -1.00 0.92 -0.84 -0.25 1.00 0.81 1.00 0.00
3.98 -1.00 0.96 -0.92 -0.13 1.00 0.57 1.00 0.00
done...

View File

@ -21,6 +21,7 @@ void setup()
gen.setAmplitude(50);
gen.setFrequency(1);
gen.setDutyCycle(25);
}
@ -29,32 +30,38 @@ void loop()
float t = millis() * 0.001;
// UNCOMMENT WAVES YOU WANT TO SEE
// DO NOT FORGET THE '\t' SEPARATOR PRINT
// DO NOT FORGET TO PRINT THE '\t' SEPARATOR
// Serial.print(t, 3);
// Serial.print("\t");
// Serial.print(gen.square(t));
// Serial.print("\t");
Serial.print(80);
Serial.print("\t");
Serial.print(-80);
Serial.print("\t");
Serial.print(gen.square(t));
Serial.print("\t");
// Serial.print(gen.sawtooth(t, 0)); // up /| signal
// Serial.print("\t");
// Serial.print(gen.sawtooth(t, 1)); // down |\ signal
// Serial.print("\t");
// Serial.print(gen.triangle(t));
Serial.print(gen.triangle(t));
// Serial.print("\t");
// Serial.print(gen.sinus(t));
// Serial.print("\t");
Serial.print(gen.stair(t, 16, 0)); // step up
Serial.print("\t");
Serial.print(gen.stair(t, 16, 1)); // step down
Serial.print("\t");
// Serial.print(gen.stair(t, 16, 0)); // step up
// Serial.print("\t");
// Serial.print(gen.stair(t, 16, 1)); // step down
// Serial.print("\t");
// Serial.print(gen.random());
// Serial.print("\t");
// Serial.print(gen.random_DC());
// Serial.print("\t");
// Serial.print(gen.line());
// Serial.print("\t");
// Serial.print(gen.zero());
Serial.println();
delay(10);
}
// -- END OF FILE --

View File

@ -8,7 +8,6 @@
// depending on the platform, the range of "smooth" sinus is limited.
// other signals are less difficult so have a slightly larger range.
// see readme.md for mac frequency table.
//
#include "functionGenerator.h"
@ -21,6 +20,8 @@ float value = 0;
float frequency = 40;
float amplitude = 1.0;
float d = 0;
// q = square
// s = sinus
// w = sawtooth
@ -91,6 +92,17 @@ void setup()
break;
case 'a':
break;
case 'D':
d = gen.getDutyCycle();
d++;
gen.setDutyCycle(d);
break;
case 'd':
d = gen.getDutyCycle();
d--;
gen.setDutyCycle(d);
break;
break;
case 'q':
case 's':
case 'w':
@ -135,4 +147,3 @@ void loop()
// -- END OF FILE --

View File

@ -0,0 +1,86 @@
//
// FILE: functionGenerator_double_MCP4725.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo function generators
// URL: https://github.com/RobTillaart/FunctionGenerator
//
// depending on the platform, the range of "smooth" sinus is limited.
// other signals are less difficult so have a slightly larger range.
// see readme.md for mac frequency table.
#include "functionGenerator.h"
#include "MCP4725.h"
#include "Wire.h"
// two generators
funcgen gen1;
funcgen gen2;
// two ADC
MCP4725 MCP1(0x63);
MCP4725 MCP2(0x64);
uint32_t count = 0;
uint32_t lastTime = 0;
uint32_t t = 0;
void setup()
{
Serial.begin(230400);
Serial.println();
Serial.println(__FILE__);
Serial.println();
Wire.begin();
MCP1.begin();
MCP2.begin();
Wire.setClock(100000);
// if (!MCP1.isConnected())
// {
// Serial.println("error 1!");
// while (1);
// }
MCP1.setValue(0);
// if (!MCP2.isConnected())
// {
// Serial.println("error 2!");
// while (1);
// }
MCP2.setValue(0);
// set 5 Hz
gen1.setAmplitude(1023);
gen1.setYShift(1023);
gen1.setFrequency(5);
// set 10 Hz
gen2.setAmplitude(1023);
gen2.setYShift(1023);
gen2.setFrequency(10);
gen2.setPhase(0.025);
}
void loop()
{
uint32_t now = micros();
if (now - lastTime >= 1000)
{
lastTime = now;
float t = millis() * 0.0001;
MCP1.setValue(gen1.square(t));
MCP2.setValue(gen2.sinus(t));
// Serial.print(gen1.square(t));
// Serial.print("\t");
// Serial.print(gen2.sinus(t));
// Serial.println();
}
}
// -- END OF FILE --

View File

@ -1,11 +1,9 @@
//
// FILE: functionGenerator.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.2.4
// VERSION: 0.2.5
// PURPOSE: wave form generating functions (use with care)
// URL: https://github.com/RobTillaart/FunctionGenerator
//
// HISTORY: see changelog.md
#include "functionGenerator.h"
@ -17,9 +15,14 @@ funcgen::funcgen(float period, float amplitude, float phase, float yShift)
setAmplitude(amplitude);
setPhase(phase);
setYShift(yShift);
setDutyCycle(50); // TODO param?
}
/////////////////////////////////////////////////////////////
//
// CONFIGURATION
//
void funcgen::setPeriod(float period)
{
_period = period;
@ -30,6 +33,88 @@ void funcgen::setPeriod(float period)
}
float funcgen::getPeriod()
{
return _period;
}
void funcgen::setFrequency(float freq)
{
setPeriod(1.0 / freq);
}
float funcgen::getFrequency()
{
return _freq1;
}
void funcgen::setAmplitude(float ampl)
{
_amplitude = ampl;
}
float funcgen::getAmplitude()
{
return _amplitude;
}
void funcgen::setPhase(float phase)
{
_phase = phase;
}
float funcgen::getPhase()
{
return _phase;
}
void funcgen::setYShift(float yShift)
{
_yShift = yShift;
}
float funcgen::getYShift()
{
return _yShift;
}
void funcgen::setDutyCycle(float dutyCycle)
{
// negative dutyCycle? => 1-dc? or abs()?
if (dutyCycle < 0) _dutyCycle = 0.0;
else if (dutyCycle > 100) _dutyCycle = 1.0;
else _dutyCycle = dutyCycle * 0.01;
}
float funcgen::getDutyCycle()
{
return _dutyCycle * 100.0;
}
void funcgen::setRandomSeed(uint32_t a, uint32_t b)
{
// prevent zero loops in random() function.
if (a == 0) a = 123;
if (b == 0) b = 456;
_m_w = a;
_m_z = b;
}
/////////////////////////////////////////////////////////////
//
// FUNCTIONS
//
float funcgen::line()
{
return _yShift + _amplitude;
@ -48,14 +133,14 @@ float funcgen::sawtooth(float t, uint8_t mode)
t += _phase;
if (t >= 0.0)
{
if (t >= _period) t = fmod(t, _period);
t = fmod(t, _period);
if (mode == 1) t = _period - t;
rv = _amplitude * (-1.0 + t *_freq2);
}
else
{
t = -t;
if (t >= _period) t = fmod(t, _period);
t = fmod(t, _period);
if (mode == 1) t = _period - t;
rv = _amplitude * ( 1.0 - t * _freq2);
}
@ -72,14 +157,16 @@ float funcgen::triangle(float t)
{
t = -t;
}
if (t >= _period) t = fmod(t, _period);
if ( t * 2 < _period)
t = fmod(t, _period);
if (t < (_period * _dutyCycle))
{
rv = _amplitude * (-1.0 + t * _freq4);
rv = _amplitude * (-1.0 + t * _freq2 / _dutyCycle);
}
else
{
rv = _amplitude * (3.0 - t * _freq4);
// mirror math
t = _period - t;
rv = _amplitude * (-1.0 + t * _freq2 /(1 - _dutyCycle));
}
rv += _yShift;
return rv;
@ -92,15 +179,15 @@ float funcgen::square(float t)
t += _phase;
if (t >= 0)
{
if (t >= _period) t = fmod(t, _period);
if ((t + t) < _period) rv = _amplitude;
t = fmod(t, _period);
if (t < (_period * _dutyCycle)) rv = _amplitude;
else rv = -_amplitude;
}
else
{
t = -t;
if (t >= _period) t = fmod(t, _period);
if ( t * 2 < _period) rv = -_amplitude;
t = fmod(t, _period);
if (t < (_period * _dutyCycle)) rv = -_amplitude;
else rv = _amplitude;
}
rv += _yShift;
@ -123,13 +210,13 @@ float funcgen::stair(float t, uint16_t steps, uint8_t mode)
t += _phase;
if (t >= 0)
{
if (t >= _period) t = fmod(t, _period);
t = fmod(t, _period);
if (mode == 1) t = _period - t;
int level = steps * t / _period;
return _yShift + _amplitude * (-1.0 + 2.0 * level / (steps - 1));
}
t = -t;
if (t >= _period) t = fmod(t, _period);
t = fmod(t, _period);
if (mode == 1) t = _period - t;
int level = steps * t / _period;
return _yShift + _amplitude * (1.0 - 2.0 * level / (steps - 1));
@ -138,12 +225,22 @@ float funcgen::stair(float t, uint16_t steps, uint8_t mode)
float funcgen::random()
{
// TODO smart reseed needed
float rv = _yShift + _amplitude * _random() * 0.2328306436E-9; // div 0xFFFFFFFF
return rv;
}
// duty cycle variant takes more than twice as much time.
float funcgen::random_DC()
{
static float rv = 0;
float next = _yShift + _amplitude * _random() * 0.2328306436E-9; // div 0xFFFFFFFF
rv += (next - rv) * _dutyCycle;
return rv;
}
// An example of a simple pseudo-random number generator is the
// Multiply-with-carry method invented by George Marsaglia.
// two initializers (not null)
@ -155,6 +252,7 @@ uint32_t funcgen::_random()
}
/////////////////////////////////////////////////////////////
//
// INTEGER VERSIONS FOR 8 BIT DAC
//
@ -198,13 +296,14 @@ uint8_t ifgstr(uint16_t t, uint16_t period = 1000, uint16_t steps = 8)
*/
/////////////////////////////////////////////////////////////
//
// SIMPLE float ONES
//
// t = 0..period
// period = 0.001 ... 10000 ?
/*
/*
float fgsaw(float t, float period = 1.0)
{
if (t >= 0) return -1.0 + 2 * t / period;
@ -250,10 +349,10 @@ float fgstr(float t, float period = 1.0, uint16_t steps = 8)
int level = steps * t / period;
return 1.0 - 2.0 * level / (steps - 1);
}
*/
/////////////////////////////////////////////////////////////
//
// FULL floatS ONES
//

View File

@ -13,15 +13,23 @@ setAmplitude KEYWORD2
getAmplitude KEYWORD2
setPhase KEYWORD2
getPhase KEYWORD2
setYShift KEYWORD2
getYShift KEYWORD2
setDutyCycle KEYWORD2
getDutyCycle KEYWORD2
setRandomSeed KEYWORD2
sawtooth KEYWORD2
triangle KEYWORD2
square KEYWORD2
sinus KEYWORD2
stair KEYWORD2
random KEYWORD2
random_DC KEYWORD2
line KEYWORD2
zero KEYWORD2

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/FunctionGenerator"
},
"version": "0.2.4",
"version": "0.2.5",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=FunctionGenerator
version=0.2.4
version=0.2.5
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library to generate wave forms (nummeric) for a DAC

View File

@ -13,7 +13,7 @@ Arduino library to generate (numeric) wave forms for a DAC.
## Description
This library presents a class for a function generator in software.
This library presents a class for a function generator in **software**.
It is typical used to control one or more DAC's.
To maximize signal quality one has to apply all (or most) processor power
to calculate new values over and over again to get enough resolution.
@ -25,119 +25,203 @@ Note: this class generates float values, performance wise this can be optimized,
to achieve higher speeds at cost of accuracy / precision.
## Performance
#### Performance
Indication of what performance can be expected (based upon 0.2.1 version).
Note that the values need to be transported to a DAC or serial port too.
Numbers based on performance example, for one single signal.
| Processor | Clock | Waveform | usec/calls | max freq |
|:-------------|---------:|:---------|-----------:|---------:|
| Arduino UNO | 16 MHz | sawtooth | 62 | 60 Hz |
| Arduino UNO | 16 MHz | triangle | 74 | 50 Hz |
| Arduino UNO | 16 MHz | square | 53 | 1000 Hz |
| Arduino UNO | 16 MHz | sinus | 164 | 25 Hz |
| Arduino UNO | 16 MHz | stair | 81 | 50 Hz |
| Arduino UNO | 16 MHz | random | 37 | 1000 Hz |
| | | | | |
| ESP32 | 240 MHz | sawtooth | 3.8 | 1000 Hz |
| ESP32 | 240 MHz | triangle | 3.9 | 1000 Hz |
| ESP32 | 240 MHz | square | 2.8 | 1000 Hz |
| ESP32 | 240 MHz | sinus | 13.6 | 250 Hz |
| ESP32 | 240 MHz | stair | 4.8 | 800 Hz |
| ESP32 | 240 MHz | random | 1.3 | 1000 Hz |
| Processor | Clock | Waveform | usec/call | max freq | max values/period |
|:--------------|----------:|:-----------|------------:|-----------:|--------:|
| Arduino UNO | 16 MHz | sawtooth | 62 | 60 Hz | 268 |
| Arduino UNO | 16 MHz | triangle | 74 | 50 Hz | 270 |
| Arduino UNO | 16 MHz | square | 53 | 1000 Hz | 19 |
| Arduino UNO | 16 MHz | sinus | 164 | 25 Hz | 152 |
| Arduino UNO | 16 MHz | stair | 81 | 50 Hz | 246 |
| Arduino UNO | 16 MHz | random | 37 | 1000 Hz | 27 |
| ESP32 | 240 MHz | sawtooth | 3.8 | 1000 Hz | 263 |
| ESP32 | 240 MHz | triangle | 3.9 | 1000 Hz | 256 |
| ESP32 | 240 MHz | square | 2.8 | 1000 Hz | 357 |
| ESP32 | 240 MHz | sinus | 13.6 | 250 Hz | 294 |
| ESP32 | 240 MHz | stair | 4.8 | 800 Hz | 260 |
| ESP32 | 240 MHz | random | 1.3 | 1000 Hz | 769 |
- assumption minimal 250 samples per period to get a smooth signal.
if a rougher signal is OK, higher frequencies are possible.
- Assumption minimal around 250 samples per period to get a smooth signal.
If a rougher signal is OK, higher frequencies are possible.
For **square()** and **random()** less samples per period are often acceptable.
- ESP32 can do more calculations however 1000 Hz seems to be a nice
upper limit for a software based function generator.
- if one wants to control multiple DAC's one need to divide the numbers
and round down.
- If one needs to control multiple DAC's one should divide the numbers
and round down to get an estimate.
Note: hardware function generator https://github.com/RobTillaart/AD985X
Note: 0.2.5 due to duty cycle the triangle and square
have become slightly slower.
| Processor | Clock | Waveform | usec/call | max freq |
|:--------------|----------:|:-----------|------------:|-----------:|
| Arduino UNO | 16 MHz | triangle | 84 | 50 Hz |
| Arduino UNO | 16 MHz | square | 57 | 1000 Hz |
| Arduino UNO | 16 MHz | random_DC | 68 | 500 Hz |
#### Accuracy
If the time parameter **t** grows large, the internal math may have rounding
problems after some time. This can and will affect the quality of the output.
Needs further investigations.
## Interface
### Constructor
```cpp
#include "functionGenerator.h"
```
#### Constructor
- **funcgen(float period = 1.0, float amplitude = 1.0, float phase = 0.0, float yShift = 0.0)**
All parameters can be set in the constructor but also later in configuration.
All parameters (except duty cycle) can be set in the constructor but also later in configuration.
Default dutyCycle is 50%.
### Configuration
#### Configuration
- **void setPeriod(float period = 1.0)** set the period of the wave in seconds.
- **float getPeriod()** returns the set period.
- **void setFrequency(float frequency = 1.0)** set the frequency of the wave in Hertz (1/s).
- **float getFrequency()** returns the set frequency in Hertz.
- **void setAmplitude(float amplitude = 1.0)** sets the amplitude of the wave. TODO point to point?
Setting the amplitude to 0 gives ?what?
- **void setAmplitude(float amplitude = 1.0)** sets the amplitude of the wave.
The range is from **-amplitude** to **+amplitude**.
Setting the amplitude to 0 gives effectively a zero signal.
Setting the amplitude to a negative value effectively inverts the signal.
- **float getAmplitude()** returns the set amplitude.
- **void setPhase(float phase = 0.0)** shifts the phase of the wave. Will only be noticeable when
compared with other waves.
- **void setPhase(float phase = 0.0)** shifts the phase of the wave.
Will only be noticeable when compared with other waves.
Phase is also known as the X- or horizontal shift.
- **float getPhase()** returns the set phase.
- **void setYShift(float yShift = 0.0)** sets an Y-shift in amplitude, allows to set some zero point.
- **void setYShift(float yShift = 0.0)** sets an Y-shift or vertical offset in amplitude.
This allows to set e.g. the zero level.
- **float getYShift()** returns the set Y-shift.
- **void setDutyCycle(float percentage = 100)** sets the duty cycle of the signal.
Experimental, not all waveforms have a duty cycle or interpret it differently, see below.
Duty cycle must be between 0 and 100% and will be clipped otherwise.
- **float getDutyCycle()** returns the set duty cycle.
- **void setRandomSeed(uint32_t a, uint32_t b = 314159265)** sets the initial seeds for the
(Marsaglia) random number generator. The first is mandatory, the second is optional.
### Wave forms
#### Wave forms
t is time in seconds
The variable t == time in seconds.
- **float sawtooth(float t, uint8_t mode = 0)** mode == 0 (default) ==> sawtooth /|. mode == 1 ==> sawtooth |\.
- **float triangle(float t)** triangle form, duty cycle 50%.
- **float square(float t)** square wave with duty cycle 50%.
- **float sawtooth(float t, uint8_t mode = 0)** mode 0 is default.
- mode == 0 ==> sawtooth /|.
- mode == 1 ==> sawtooth |\\. Effectively equals inverting the amplitude.
- **float triangle(float t)** triangle form, duty cycle default 50%.
- **float square(float t)** square wave with duty cycle default 50%.
- **float sinus(float t)** sinus wave, has no duty cycle.
- **float stair(float t, uint16_t steps = 8, uint8_t mode = 0)** mode = 0 ==> steps up, mode = 1 steps down.
- **float random()** noise generation.
- **float line()** constant voltage line. Depends on the set YShift and amplitude.
- **float stair(float t, uint16_t steps = 8, uint8_t mode = 0)** defaults to 8 steps up.
- mode = 0 ==> steps up
- mode = 1 ==> steps down. Effectively equals inverting the amplitude.
- **float random()** random noise generation.
- **float line()** constant voltage line.
Height depends on the YShift and amplitude.
- **float zero()** constant zero.
Line() and zero() are functions that can be used to drive a constant voltage from a DAC
and can be used to calibrate the generator / DAC combination.
The functions **line()** and **zero()** can be used to drive a constant voltage
from a DAC and can be used to calibrate the generator / DAC combination.
## Operational
#### Duty Cycle
See examples.
Since 0.2.5 the library has **experimental** support for duty cycle.
The meaning of duty cycle differs per wave form.
Implementation may change in the future.
In first iteration the following behaviour is implemented:
- **square()** implements duty cycle in a well known way.
At the start of the period the signal goes "HIGH".
After duty cycle % of the period the signal goes LOW until the end of the period.
- **triangle()** function uses the duty cycle to shift the peak from the
begin (0%) to middle (50%) to end (100%) of the period.
- **random_DC()** A duty cycle of 0% is no noise 100% is full amplitude noise
with respect to previous value.
Implemented as a weighed average between new and previous value.
Made a separate function as handling the duty cycle slows performance substantial.
Initial starts at zero and can be adjusted with **YShift()**.
The other functions need to be investigated what duty cycle means.
Current ideas that are **NOT** implemented:
- **sawtooth()** - move from /|. to /|__ so 0% is a spike, 100% = normal.
Think of it as the halve of the triangle wave.
- **sinus()** move the two peaks like the triangle (adjusting steepness / freq)??
- **stair()** like sawtooth??
- **line()** has no period so does not make sense (yet).
- **zero()** has no period so does not make sense (yet).
Feedback and ideas are welcome.
## Future
#### waveforms
#### Must
- square duty-cycle (will be slower!)
- triangle duty-cycle (makes sawtooth a special triangle)
- trapezium wave (would merge square and triangle and sawtooth)
- Bezier curve?
- documentation
- quality of signals - after substantial time t
- max freq per wave form etc.
Should this be in the library?
#### investigate
- duty-cycle for sinus what does it mean. move peak.
#### Should
- smart reseed needed for random().
- initialize random generator with compile time.
#### Could
- waves
- trapezium wave (could merge square and triangle and sawtooth)
- white noise, pink noise etc.
- investigate algorithms for performance gains (DAC specific values 10-12-16 bit)
- Amplitude modulation ?
- external clock to synchronize two or more sw function generators.
- RC function curve.
- heartbeat curve?
- record a signal and play back
#### misc
- stand-alone functions in separate .h?
- mapping to voltage function.
- external clock to synchronize two or more software function generators.
- stand-alone functions in separate .h
- check for synergy with https://github.com/RobTillaart/AD985X
- investigate performance.
- algorithms for DAC specific gains e.g. 10-12-16 bit.
- improve performance sin() lookup table.
- add float variable for ```_perDC = _period * _dutyCycle```
- do we need **freq4** ? not since DC.
#### examples
- example ESP32 version as separate task...
#### Examples
- Amplitude modulation ?
- heartbeat curve?
- example ESP32 version as separate task.
- example with DAC. 8 12 16 bit.
- example with potentiometers for 4 parameters
#### Wont
- investigate duty cycle for waveforms
- Derived class for the duty cycle variants? or functions!
- **float squareDC()** performance (loss)
- **float triangleDC()**
- **float sawtoothDC()**
- **float sinusDC()** duty-cycle for sinus what does it mean.
- ==> move peaks, two half sinus with diff frequency
- **float stairDC()**
- Bezier curve? (too complex)
- record a signal and play back ==> separate class

View File

@ -33,6 +33,7 @@ unittest_setup()
fprintf(stderr, "FUNCTIONGENERATOR_LIB_VERSION: %s\n", (char*) FUNCTIONGENERATOR_LIB_VERSION);
}
unittest_teardown()
{
}
@ -46,8 +47,10 @@ unittest(test_constructor)
assertEqualFloat(1, gen.getPeriod(), 0.0001);
assertEqualFloat(1, gen.getFrequency(), 0.0001);
assertEqualFloat(1, gen.getAmplitude(), 0.0001);
assertEqualFloat(0, gen.getPhase(), 0.0001);
assertEqualFloat(0, gen.getYShift(), 0.0001);
assertEqualFloat(50, gen.getDutyCycle(), 0.0001);
}
@ -60,8 +63,10 @@ unittest(test_constructor_param)
assertEqualFloat(4.00, gen.getPeriod(), 0.0001);
assertEqualFloat(0.25, gen.getFrequency(), 0.0001);
assertEqualFloat(2.50, gen.getAmplitude(), 0.0001);
assertEqualFloat(0.33, gen.getPhase(), 0.0001);
assertEqualFloat(-0.5, gen.getYShift(), 0.0001);
assertEqualFloat(50, gen.getDutyCycle(), 0.0001);
}
@ -85,6 +90,9 @@ unittest(test_set_get_param)
gen.setYShift(6.89);
assertEqualFloat(6.89, gen.getYShift(), 0.0001);
gen.setDutyCycle(14.28);
assertEqualFloat(14.28, gen.getDutyCycle(), 0.0001);
}
@ -112,6 +120,9 @@ unittest(test_line_zero)
TODO wave forms 6x ?
*/
unittest_main()
// --------
// -- END OF FILE --