How can I make a vector in matlab, like vec(x)?

33 visualizzazioni (ultimi 30 giorni)
Jonathan Janka
Jonathan Janka il 1 Dic 2017
Commentato: Jonathan il 2 Ago 2018
Hello all,
I am trying to replicate this formula:
I am doing so as follows:
Theta = A*B-C;
vTheta = vec(Theta');
A, B en C are defined. The problem is that Matlab does not seem to know the function 'vec' to do what I would like to do with Theta as in the formula...
How can I fix this?
Thanks in advance!
  3 Commenti
Jan
Jan il 2 Dic 2017
The problem is that Matlab does not seem to know the function 'vec'
"Does not seem" or do you get a real error message? If Matlab does not have such a function, you can fix this by writing it.
Sorry for this trivial answer, but the provided details do not allow to give a more specific one.
Marcos Caso-Huerta
Marcos Caso-Huerta il 2 Gen 2018
I think that Theta(:) is what you're looking for.

Accedi per commentare.

Risposte (2)

Sean de Wolski
Sean de Wolski il 2 Gen 2018
I wrote a vec function in grad school for exactly this use. Here it is, authored almost exactly 7 years ago apparently!
attached.

Giacomo Romanini
Giacomo Romanini il 12 Feb 2018
Suppose you have a matrix X. You can obtain a vec(X) simply by the following:
vecX = X(:);

Categorie

Scopri di più su Performance and Memory in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by