Main Content

conj

Complex conjugate of symbolic input

Syntax

Description

example

conj(x) returns the complex conjugate of x. Because symbolic scalar variables are complex by default, unresolved calls, such as conj(x), can appear in the output of norm, mtimes, and other functions. For details, see Use Assumptions on Symbolic Variables.

For complex x, conj(x) = real(x) - i*imag(x).

Examples

collapse all

Compute the conjugate of numeric input.

conj(1+3i)
ans =
   1.0000 - 3.0000i

Compute the conjugate of symbolic input.

syms x
f = x^2;
fConj = conj(f)
fConj =
conj(x)^2

Convert symbolic output to double by substituting for x with a number by using subs, and then using double.

fConj = subs(fConj,x,1+2i);        % x is 1+2i
fConj = double(fConj)
fConj =
  -3.0000 - 4.0000i

If the input is real, conj returns the input instead of an unresolved call. Assume x is real and find its conjugate. conj returns x instead of conj(x), as expected.

syms x
assume(x,'real')
conj(x)
ans =
x

Clear the assumption for further computations.

assume(x,'clear')

Input Arguments

collapse all

Input, specified as a number, vector, matrix, or array, or a symbolic number, scalar variable, matrix variable, array, function, matrix function, or expression.

Version History

Introduced before R2006a

expand all

See Also

|