In this section, we are going to create two signals and calculate their error sum:
- As always, the include statements come first. Then, we declare that we use the std namespace:
#include <iostream> #include <cmath> #include <algorithm> #include <numeric>
#include <vector> #include <iterator> using namespace std;
- We are going to calculate the error sum of two signals. The two signals will be a sine wave and a copy of it, but with a different value type--the original sine wave is saved in a vector of double variables and its copy is saved in a vector of int variables. Because copying a value from a double variable to an int variable cuts its decimal part after the point, we have some loss. Let's name the vector of ...