Austin Schuh | ab802d5 | 2020-07-03 18:11:11 -0700 | [diff] [blame] | 1 | #define _USE_MATH_DEFINES |
| 2 | #include <cmath> |
Austin Schuh | 6c8ec4c | 2018-01-23 11:18:57 -0800 | [diff] [blame] | 3 | #include "../matplotlibcpp.h" |
| 4 | #include <vector> |
Austin Schuh | 6c8ec4c | 2018-01-23 11:18:57 -0800 | [diff] [blame] | 5 | |
| 6 | namespace plt = matplotlibcpp; |
| 7 | |
| 8 | int main() { |
| 9 | std::vector<double> t(1000); |
| 10 | std::vector<double> x(t.size()); |
| 11 | |
| 12 | for(size_t i = 0; i < t.size(); i++) { |
| 13 | t[i] = i / 100.0; |
| 14 | x[i] = sin(2.0 * M_PI * 1.0 * t[i]); |
| 15 | } |
| 16 | |
| 17 | plt::xkcd(); |
| 18 | plt::plot(t, x); |
| 19 | plt::title("AN ORDINARY SIN WAVE"); |
| 20 | plt::show(); |
| 21 | } |
| 22 | |