LINSPACENDIM is a good extension of the Matlab function linspace to any multidimensional elements.
LINSPACENDIM(d1, d2) generates a multi-dimensional
matrix of 100 linearly equally spaced points between
each element of matrices d1 and d2.
LINSPACENDIM(d1, d2, N) generates N points between
each element of matrices X1 and X2.
Example:
d1 = rand(3, 2, 4); d2 = rand(size(d1)); n = 1;
y = linspaceNDim(d1, d2, n) returns a multidimensional matrix y of
size (2, 4, 3, 10)
Class support for inputs X1,X2:
float: Multidimensional matrix, vector, double, single
--> I do not use Loop! <--
I use an old function that I wrote to make the tensor product of two(2) multidimensional matrices of of any size and any number of dimensions.
|