This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

rhs

Right side (RHS) of equation

Syntax

rhs(eqn)

Description

example

rhs(eqn) returns the right side of the symbolic equation eqn. The value of eqn also can be a symbolic condition, such as x > 0. If eqn is an array, then rhs returns an array of the right sides of the equations in eqn.

Examples

Find Right Side of Equation

Find the right side of the equation 2*y == x^2 by using rhs.

First, declare the equation.

syms x y
eqn = 2*y == x^2
eqn =
2*y == x^2

Find the right side of eqn by using rhs.

rhsEqn = rhs(eqn)
rhsEqn =
 x^2

Find Right Side of Condition

Find the right side of the condition x < y + 1 by using rhs.

First, declare the condition.

syms x y
cond = x < y + 1
cond =
x < y + 1

Find the right side of cond by using rhs.

rhsCond = rhs(cond)
rhsCond =
y + 1

Note

Conditions that use the > operator are internally rewritten using the < operator. Therefore, rhs returns the original left side. For example, rhs(x > a) returns x.

Find Right Side of Equations in Array

For an array that contains equations and conditions, rhs returns an array of the right sides of those equations or conditions. The output array is the same size as the input array.

Find the right side of the equations and conditions in the vector V.

syms x y
V = [y^2 == x^2, x ~= 0, x*y >= 1]
V =
[ y^2 == x^2, x ~= 0, 1 <= x*y]
rhsV = rhs(V)
rhsV =
[ x^2, 0, x*y]

Because any condition using the >= operator is internally rewritten using the <= operator, the sides of the last condition in V are exchanged.

Input Arguments

collapse all

Equation or condition, specified as a symbolic equation or condition, or a vector, matrix, or multidimensional array of symbolic equations or conditions.

See Also

| | |

Introduced in R2017a