Info

This question is closed. Reopen it to edit or answer.

If I have a vector A with dimensions (1,3) and an other vector with dimensions B (3,1) , then the action A.*B is a matrix with dimensions (3,3) or a vector with dimensions (3,3) ?

5 views (last 30 days)
If I have a vector A with dimensions (1,3) and an other vector with dimensions B (3,1) , then the action A.*B is a matrix with dimensions (3,3) or a vector with dimensions (3,3) ?In matlab are there well-defined vectors that have (nxn) dimensions?

Answers (2)

KL
KL on 18 Nov 2017
I think you're confused with the terms, vectors and matrices.
Vectors or Arrays
These are one dimensional. They either have one row with multiple columns (row vector) or one column with multiple rows (column vector). In your case, A is a row vector and B is a column vector.
Matrices
These can have 2 or more dimensions. A simple 2-dimensional matrix have multiple rows and multiple columns. It's also possible to create N-dimensional matrix but considering your question, that is a little beyond what you might need now.

Image Analyst
Image Analyst on 18 Nov 2017
Yes, this is called "automatic expansion" and was introduced in a recent version.
To answer your question, no, there are not "well-defined vectors that have (nxn) dimensions". To be called a vector one of the dimensions must be 1. If it has 2 dimensions, it's called a matrix. There are some well-defined matrices that have (nxn) dimensions, for example magic(n) produces such a matrix. There are also lots of other functions to create well known matrices such as zeros(), ones(), toeplitz(), hankel(), rand(), randi(), randn(), pdist2(), etc.

This question is closed.

Community Treasure Hunt

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

Start Hunting!