8 template <
size_t STATE_DIM,
size_t CONTROL_DIM>
13 #ifdef PLOTTING_ENABLED 22 if (timeArray.size() != stateArray.size())
24 std::cout << timeArray.size() << std::endl;
25 std::cout << stateArray.size() << std::endl;
26 throw std::runtime_error(
"Cannot plot data, x and t not equal length");
29 std::vector<double> position;
30 std::vector<double> velocity;
31 std::vector<double> time_state;
32 for (
size_t j = 0; j < stateArray.size(); j++)
34 position.push_back(stateArray[j](0));
35 velocity.push_back(stateArray[j](1));
36 time_state.push_back(timeArray[j]);
39 std::vector<double> control;
40 std::vector<double> time_control;
41 for (
size_t j = 0; j < controlArray.size(); j++)
43 control.push_back(controlArray[j](0));
44 time_control.push_back(timeArray[j]);
60 }
catch (
const std::exception& e)
62 std::cout << e.what() << std::endl;
65 std::cout <<
"Plotting is disabled." << std::endl;
void plotResultsOscillator(const ct::core::StateVectorArray< STATE_DIM > &stateArray, const ct::core::ControlVectorArray< CONTROL_DIM > &controlArray, const ct::core::TimeArray &timeArray)
Definition: plotResultsOscillator.h:9
bool plot(const Eigen::Ref< const Eigen::MatrixXd > &x, const Eigen::Ref< const Eigen::MatrixXd > &y, const std::map< std::string, std::string > &keywords)
void show(bool block=true)
void title(const std::string &titlestr)
bool subplot(const size_t nrows, const size_t ncols, const size_t plot_number)
bool figure(std::string i="")