Go to the documentation of this file.
35 cout <<
"Histogram test:" << endl;
36 cout <<
"Should be 1: " << hist.getBinCount(0) << endl;
37 cout <<
"Should be 0.33: " << hist.getBinRatio(0)
53 win1.resize(400, 400);
56 std::vector<size_t> v1(100000);
61 hist.getHistogramNormalized(x, y);
71 win2.resize(400, 400);
78 hist.getHistogramNormalized(x, y);
85 win2.plot(x, y_real,
"k-",
"real");
93 win3.resize(400, 400);
100 hist.getHistogramNormalized(x, y);
102 win3.plot(x, y,
"b");
107 win3.plot(x, y_real,
"k-",
"real");
114 win4.setPos(420, 430);
115 win4.resize(400, 400);
117 vector<CVectorDouble> v1;
126 v1, 10000,
cov, &Mean);
131 mrpt::math::meanAndCov(v1,m,c);
132 cout <<
"Mean: " << m << endl;
133 cout <<
"Std: " << endl << c << endl;
138 for (
size_t i = 0; i < v1.size(); i++)
144 win4.plot(x, y,
"b.3");
147 Mean[0], Mean[1],
cov, 3.0,
"k-2",
"99% ellipse",
true);
167 catch (
const std::exception& e)
174 printf(
"Untyped exception!!");
CMatrixDouble cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample,...
void TestRandomGenerators()
This class provides an easy way of computing histograms for unidimensional real valued variables.
bool fromMatlabStringFormat(const std::string &s, mrpt::optional_ref< std::ostream > dump_errors_here=std::nullopt)
Reads a matrix from a string in Matlab-like format, for example: "[1 0 2; 0 4 -1]" The string must st...
void drawGaussian1DVector(VEC &v, const double mean=0, const double std=1)
Fills the given vector with independent, 1D-normally distributed samples.
void drawGaussianMultivariateMany(VECTOR_OF_VECTORS &ret, size_t desiredSamples, const COVMATRIX &cov, const typename VECTOR_OF_VECTORS::value_type *mean=nullptr)
Generate a given number of multidimensional random samples according to a given covariance matrix.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double normalPDF(double x, double mu, double std)
Evaluates the univariate normal (Gaussian) distribution at a given point "x".
void randomize(const uint32_t seed)
Initialize the PRNG from the given random seed.
A compile-time fixed-size numeric matrix container.
Classes for creating GUI windows for 2D and 3D visualization.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
This base provides a set of functions for maths stuff.
A namespace of pseudo-random numbers generators of diferent distributions.
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
void pause(const std::string &msg=std::string("Press any key to continue...")) noexcept
Shows the message "Press any key to continue" (or other custom message) to the current standard outpu...
void drawUniformVector(VEC &v, const double unif_min=0, const double unif_max=1)
Fills the given vector with independent, uniformly distributed samples.
Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Sat Jun 27 14:00:59 UTC 2020 | |