12 #ifdef PLOTTING_ENABLED 20 if (timeArray.size() != stateArray.size())
22 std::cout << timeArray.size() << std::endl;
23 std::cout << stateArray.size() << std::endl;
24 throw std::runtime_error(
"Cannot plot data, x and t not equal length");
27 std::vector<std::vector<double>> states;
28 std::vector<double> time_state;
29 std::vector<double> constraint;
30 for (
size_t k = 0; k < 2; k++)
32 states.push_back(std::vector<double>());
35 for (
size_t j = 0; j < stateArray.size(); j++)
37 for (
size_t k = 0; k < 2; k++)
39 states[k].push_back(stateArray[j](k));
41 time_state.push_back(timeArray[j]);
42 constraint.push_back(stateArray[j](0) + stateArray[j](1));
45 std::vector<double> control;
46 std::vector<double> time_control;
47 for (
size_t j = 0; j < controlArray.size(); j++)
49 control.push_back(controlArray[j](0));
50 time_control.push_back(timeArray[j]);
53 for (
size_t k = 0; k < 2; k++)
70 }
catch (
const std::exception& e)
72 std::cout << e.what() << std::endl;
75 std::cout <<
"Plotting is disabled." << std::endl;
void plotResults(const ct::core::StateVectorArray< 2 > &stateArray, const ct::core::ControlVectorArray< 1 > &controlArray, const ct::core::TimeArray &timeArray)
Definition: plotResultsSwitched.h:8
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="")