I have 3 vectors x,y and z. How can I create an array a so that a(i,j,k) = [x(i),y(j),z(k)]?
I tried
a(:,:,1) = [[1,2];[3,4]]
but got
Subscripted assignment dimension mismatch.
edit after comment
Basically I first wanted to create an array a from x,y,z, but here is my original problem (so I think creating a vector would be better): I have three vectors: x,y,z, say x = [1 2 3], y = [4,3,2] z = [1,3,2]
I want to compute the gaussian probability function on each [x_i,y_j,z_k] I was thinking using an array. So I first tried using mvnpdf with an array a:
a = rand(3,3,3) < 0.1
and mvnpdf(a,[1,2,3],eye(3))
But matlab returned the following error:
Error using mvnpdf (line 46)
X must be a matrix.
Apparently, he is not happy with me using arrays.
Do you have any idea how I could compute what I want to (apart from using for loops that would take far too long for the size of my real vectors x,y,z).
a = [x(:) y(:) z(:)]do what you want? Seemsmvnpdf(a,...)needs the first input argumentato beN-by-D.N-by-Dmatrix.