22 template <
typename TRAJECTORY_T>
23 TRAJECTORY_T
linspace(
const typename TRAJECTORY_T::value_type& a,
24 const typename TRAJECTORY_T::value_type& b,
28 throw std::runtime_error(
"ERROR in CT_LINSPACE: N<1.");
30 typename TRAJECTORY_T::value_type h = (b - a) / (N - 1);
33 typename TRAJECTORY_T::iterator it;
34 typename TRAJECTORY_T::value_type val;
36 for (it = traj.begin(), val = a; it != traj.end(); ++it, val += h)
TRAJECTORY_T linspace(const typename TRAJECTORY_T::value_type &a, const typename TRAJECTORY_T::value_type &b, const size_t N)
replicates the well-known linspace command from MATLAB in C++
Definition: linspace.h:23