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

조회 수: 33 (최근 30일)
Jonathan Janka
Jonathan Janka 2017년 12월 1일
댓글: Jonathan 2018년 8월 2일
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
Jan
Jan 2017년 12월 2일
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 2018년 1월 2일
I think that Theta(:) is what you're looking for.

댓글을 달려면 로그인하십시오.

답변 (2개)

Sean de Wolski
Sean de Wolski 2018년 1월 2일
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 2018년 2월 12일
Suppose you have a matrix X. You can obtain a vec(X) simply by the following:
vecX = X(:);
  댓글 수: 1
Jonathan
Jonathan 2018년 8월 2일

Already answered in the comments (2 Jan 2018), so kudos to Marcos Caso-Huerta

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Performance and Memory에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by