Switch to full style
C++ code examples
Post a reply

linear interpolation array c++

Sat Jul 04, 2015 2:13 pm

linear interpolation array c++ similar to the linspace function of Matlab.
cpp code
std::vector<double> ClassName::linspace(double a, double b, size_t N) {
double h = (b - a) / static_cast<double>(N-1);
vector<double> xs(N);
vector<double>::iterator x;
double val;
for (x = xs.begin(), val = a; x != xs.end(); ++x, val += h)
*x = val;
return xs;
}




Post a reply
  Related Posts  to : linear interpolation array c++
 Variable interpolation     -  
 Nearest neighbor interpolation in C++     -  
 AES -S-BOX Linear Algorithm implementation-substitution box     -  
 Build Linear Regression in Python - Supervised Learning     -  
 Array difference for associate array     -  
 compare an array with another array?     -  
 Add elements to the end of an array     -  
 Get array chunk     -  
 XML Document into an Array in php     -  
 Array sort     -