J Jones
J Jones

Reputation: 3200

matlab syntax of " ' "

I am trying to convert some matlab code into Python. I have almost no experience with matlab, but I just need to borrow a little functionality. I am stuck on this part:

In this example, V is a 3x3 matrix.

A = V(:,3)  % i.e. A = [1 2 3]
par = [-(A(2:3))'/A(1)]

Specifically, I am puzzled by the use of '.

I have been using this resource to go between matlab and Python: http://mathesaurus.sourceforge.net/matlab-numpy.html However, it is ambiguous as the ' sign appears to have multiple uses. When I search for other documentation, I can't find a comprehensive explanation for '.

Any help would be much appreciated. Ideally, I would like to get the Python equivalent, but any explanation will help. Thanks!

Upvotes: 2

Views: 214

Answers (2)

user1301404
user1301404

Reputation:

It's just to return the transpose of the matrix.

In python using numpy, you can do the following:

a.T
a.transpose()

Both will return the same result.

Upvotes: 2

bla
bla

Reputation: 26069

use a.conj().transpose() for Matlab's transpose (a')

and a.transpose() for Matlab's non-conjugate transpose (a.' or transpose(a))

Upvotes: 5

Related Questions