Effacer les filtres
Effacer les filtres

what does this mean , how and for what is it used ?

8 vues (au cours des 30 derniers jours)
dareen
dareen le 21 Mar 2024
Modifié(e) : dareen le 21 Mar 2024
while playing around in the command window with arrays and matrices i tried to
print x=ones and it gave me an array of size 1*1 containing 1
x=ones(2,3) a matrix of size 2*3 containing ones ,
x=ones(2,3,4) builds the matrix of the size i wrote and repeats it 4 times
to here there are no problems i think,
x=ones(2,3,4,5,8)
this i am not sure what it excatly does and what for ,though its written in the documentations brifely that it should be an array of 2*3*4*5*8
  7 commentaires
Stephen23
Stephen23 le 21 Mar 2024
Modifié(e) : Stephen23 le 21 Mar 2024
Example: the motion of a rigid body in 3D space fundamentally has six degrees of freedom. Each dimension is nominally independent of the other dimensions. So if you do some measurements for along each of those six dimensions, then you could store the measured data in a 6D array.
This is fundamentally no different to 2D data (e.g. an image) or any other number of dimensions of a system.
dareen
dareen le 21 Mar 2024
Modifié(e) : dareen le 21 Mar 2024
@Stephen23 thanks the example is really useful cleared this a lot, hopefully will impelement this in future codes

Connectez-vous pour commenter.

Réponse acceptée

Chunru
Chunru le 21 Mar 2024
The following will produce a 5-dimensional array of 2x3x5x5x8. You can access the element by specifying 5-d index
x=ones(2,3,4,5,8)
x =
x(:,:,1,1,1) = 1 1 1 1 1 1 x(:,:,2,1,1) = 1 1 1 1 1 1 x(:,:,3,1,1) = 1 1 1 1 1 1 x(:,:,4,1,1) = 1 1 1 1 1 1 x(:,:,1,2,1) = 1 1 1 1 1 1 x(:,:,2,2,1) = 1 1 1 1 1 1 x(:,:,3,2,1) = 1 1 1 1 1 1 x(:,:,4,2,1) = 1 1 1 1 1 1 x(:,:,1,3,1) = 1 1 1 1 1 1 x(:,:,2,3,1) = 1 1 1 1 1 1 x(:,:,3,3,1) = 1 1 1 1 1 1 x(:,:,4,3,1) = 1 1 1 1 1 1 x(:,:,1,4,1) = 1 1 1 1 1 1 x(:,:,2,4,1) = 1 1 1 1 1 1 x(:,:,3,4,1) = 1 1 1 1 1 1 x(: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,4,7) = 1 1 1 1 1 1 x(:,:,3,4,7) = 1 1 1 1 1 1 x(:,:,4,4,7) = 1 1 1 1 1 1 x(:,:,1,5,7) = 1 1 1 1 1 1 x(:,:,2,5,7) = 1 1 1 1 1 1 x(:,:,3,5,7) = 1 1 1 1 1 1 x(:,:,4,5,7) = 1 1 1 1 1 1 x(:,:,1,1,8) = 1 1 1 1 1 1 x(:,:,2,1,8) = 1 1 1 1 1 1 x(:,:,3,1,8) = 1 1 1 1 1 1 x(:,:,4,1,8) = 1 1 1 1 1 1 x(:,:,1,2,8) = 1 1 1 1 1 1 x(:,:,2,2,8) = 1 1 1 1 1 1 x(:,:,3,2,8) = 1 1 1 1 1 1 x(:,:,4,2,8) = 1 1 1 1 1 1 x(:,:,1,3,8) = 1 1 1 1 1 1 x(:,:,2,3,8) = 1 1 1 1 1 1 x(:,:,3,3,8) = 1 1 1 1 1 1 x(:,:,4,3,8) = 1 1 1 1 1 1 x(:,:,1,4,8) = 1 1 1 1 1 1 x(:,:,2,4,8) = 1 1 1 1 1 1 x(:,:,3,4,8) = 1 1 1 1 1 1 x(:,:,4,4,8) = 1 1 1 1 1 1 x(:,:,1,5,8) = 1 1 1 1 1 1 x(:,:,2,5,8) = 1 1 1 1 1 1 x(:,:,3,5,8) = 1 1 1 1 1 1 x(:,:,4,5,8) = 1 1 1 1 1 1
y = x(2, 1, 3, 3, 4) % one element of the 5-d array
y = 1
  3 commentaires
Stephen23
Stephen23 le 21 Mar 2024
"i think my confusion is more related to not being familar with anything higher tha 2d arrays"
Mathematics is not limited to working in two dimensions, why would MATLAB be?
dareen
dareen le 21 Mar 2024
makes sense this language is much more useful than i imagined

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by