| MATLAB C++ Math Library | Search  Help Desk |
| ramp | Examples |
C++ Prototype
mwArray ramp(mwArray start, mwArray end); mwArray ramp(mwArray start, mwArray step, mwArray end);
Arguments
startDescription
ramp(start, end) generates a vector of (end - start) + 1 elements. The elements in the vector are start, start+1, start+2, , start+n, end. Each element in the vector is one greater than the preceding element. Iteration stops when the start+n is larger than end, yet the last value in the vector is always end. This can decrease the distance between the last two elements to less than 1.
ramp(start, step, end) generates a vector of ((end - start)/step) + 1 elements. The elements in the vector are start, start+step, start+(2*step), start+(3*step), , start+(n*step), end. Iteration stops when the start+(n*step) is larger than end, yet the last value in the vector is always end. This can decrease the distance between the last two elements to less than step. Specifying a negative step generates a decreasing sequence. Specifying a sequence that will not terminate raises an exception.
Example
B = ramp(1,2,10);