Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# numpy.matrix

All Samples(2725)  |  Call(2527)  |  Derive(10)  |  Import(188)
```matrix(data, dtype=None, copy=True)

Returns a matrix from an array-like object, or from a string of data.
A matrix is a specialized 2-D array that retains its 2-D nature
through operations.  It has certain special operators, such as ``*``
(matrix multiplication) and ``**`` (matrix power).

Parameters
----------
data : array_like or string(more...)
```

```import numpy as np
import matplotlib.pyplot as plt

d1 = np.matrix([[1], [0]])
d2 = np.matrix([[0], [1]])
d3 = np.matrix([[0.707], [0.707]])
d4 = np.matrix([[0.707], [-0.707]])
d5 = np.matrix([[0.6], [-0.8]])
```

```            for k in L:
if self.std == None:
datak = np.matrix(self.data[:, k].reshape(n, 1) - m_mean_j)
if self.vardata != None:
vark = self.vardata[:, k] + v_j
else:
nk = int(self.N[k])
datak = np.matrix(data_I[cumsum[k] : cumsum[k + 1]].reshape(nk, 1) - m_mean_j)
```
```                    if self.vardata != None:
vark = var_I[cumsum[k] : cumsum[k + 1]]
Vk = np.matrix(np.zeros((nk, nk), float) + m_var_j)
if self.vardata == None:
Vk[xrange(nk), xrange(nk)] = v_j + m_var_j
```

```pbar = (np.ones((n, 1)) * .03 +
np.matrix(np.append(np.random.rand(n - 1, 1), 0)).T * .12)
S = np.matrix(np.random.randn(n, n))
S = S.T * S
S = S / np.max(np.abs(np.diag(S))) * .2
S[:, n - 1] = np.matrix(np.zeros((n, 1)))
S[n - 1, :] = np.matrix(np.zeros((1, n)))
x_unif = np.matrix(np.ones((n, 1))) / n
```

```pbar = (np.ones((n, 1)) * .03 +
np.matrix(np.append(np.random.rand(n - 1, 1), 0)).T * .12)
S = np.matrix(np.random.randn(n, n))
S = S.T * S
S = S / np.max(np.abs(np.diag(S))) * .2
S[:, n - 1] = np.matrix(np.zeros((n, 1)))
S[n - 1, :] = np.matrix(np.zeros((1, n)))
x_unif = np.matrix(np.ones((n, 1))) / n
```

```
# Define state space matrices
A = np.matrix([[-2, -2],
[0, -4]])
B = np.matrix([[1],
[1]])
C = np.matrix([[1, 0]])
```
```
# Create frequency domain mode;
G = sign.lti(A, B, C, D)

# Question: Why does A.transpose give the same eigenvectors as the book
```

```                phi += numpy.arcsin((1.3)/lineRadiusGuess)
phi += 10*pi/180
R_c2n = numpy.matrix([[  numpy.cos(phi), 0, numpy.sin(phi)],
[               0, 1,              0],
[ -numpy.sin(phi), 0, numpy.cos(phi)]])
```

```                phi += numpy.arcsin((conf['minAltitude']+0.3)/lineRadiusGuess)
phi += 10*pi/180
R_c2n = numpy.matrix([[  numpy.cos(phi), 0, numpy.sin(phi)],
[               0, 1,              0],
[ -numpy.sin(phi), 0, numpy.cos(phi)]])
```

```                phi += numpy.arcsin((conf['minAltitude']+0.3)/lineRadiusGuess)
phi += 10*pi/180
R_c2n = numpy.matrix([[  numpy.cos(phi), 0, numpy.sin(phi)],
[               0, 1,              0],
[ -numpy.sin(phi), 0, numpy.cos(phi)]])
```

```

G = np.matrix([[100, 0], [0, 1]])

[U, S, V] = np.linalg.svd(G)

R = RGA(G)
ItR = IterRGA(G, 4)
numR = RGAnumber(G)
```

```n = 2