pinv
Moore-Penrose inverse (pseudoinverse) of symbolic matrix
Syntax
Description
Examples
Compute Pseudoinverse of Matrix
Compute the pseudoinverse of this matrix. Because these numbers are not symbolic objects, you get floating-point results.
A = [1 1i 3; 1 3 2]; X = pinv(A)
X = 0.0729 + 0.0312i 0.0417 - 0.0312i -0.2187 - 0.0521i 0.3125 + 0.0729i 0.2917 + 0.0625i 0.0104 - 0.0938i
Now, convert this matrix to a symbolic object, and compute the pseudoinverse.
A = sym([1 1i 3; 1 3 2]); X = pinv(A)
X = [ 7/96 + 1i/32, 1/24 - 1i/32] [ - 7/32 - 5i/96, 5/16 + 7i/96] [ 7/24 + 1i/16, 1/96 - 3i/32]
Check that A*X*A = A
and X*A*X = X
.
isAlways(A*X*A == A)
ans = 2×3 logical array 1 1 1 1 1 1
isAlways(X*A*X == X)
ans = 3×2 logical array 1 1 1 1 1 1
Now, verify that A*X
and X*A
are Hermitian
matrices.
isAlways(A*X == (A*X)')
ans = 2×2 logical array 1 1 1 1
isAlways(X*A == (X*A)')
ans = 3×3 logical array 1 1 1 1 1 1 1 1 1
Compute Pseudoinverse of Matrix
Compute the pseudoinverse of this matrix.
syms a A = [1 a; -a 1]; X = pinv(A)
X = [ (a*conj(a) + 1)/(a^2*conj(a)^2 + a^2 + conj(a)^2 + 1) -... (conj(a)*(a - conj(a)))/(a^2*conj(a)^2 + a^2 + conj(a)^2 + 1), - (a - conj(a))/(a^2*conj(a)^2 + a^2 + conj(a)^2 + 1) -... (conj(a)*(a*conj(a) + 1))/(a^2*conj(a)^2 + a^2 + conj(a)^2 + 1)] [ (a - conj(a))/(a^2*conj(a)^2 + a^2 + conj(a)^2 + 1) +... (conj(a)*(a*conj(a) + 1))/(a^2*conj(a)^2 + a^2 + conj(a)^2 + 1), (a*conj(a) + 1)/(a^2*conj(a)^2 + a^2 + conj(a)^2 + 1) -... (conj(a)*(a - conj(a)))/(a^2*conj(a)^2 + a^2 + conj(a)^2 + 1)]
Now, compute the pseudoinverse of A
assuming that
a
is real.
assume(a,'real') A = [1 a; -a 1]; X = pinv(A)
X = [ 1/(a^2 + 1), -a/(a^2 + 1)] [ a/(a^2 + 1), 1/(a^2 + 1)]
For further computations, remove the assumption on a
by recreating it
using syms
.
syms a
Input Arguments
Output Arguments
More About
Tips
Version History
Introduced in R2013a