How to do matrix equality testing for symbols?

In the documentation I found this example.
A = [1+i 3 2 4+i];
B = [1 3+i 2 4+i];
A == B
The result is:
ans = 1x4 logical array
0 0 1 1
How can I make the == operator work for symbols? I tried below example:
syms a b [3 1] real
r1 = a*b';
r2 = b*a';
r1 == r2
and the result is:
Is it possible to compare symbol expressions?

답변 (1개)

madhan ravi
madhan ravi 2020년 6월 17일

0 개 추천

syms a b [3 1] real
assume([a, b] > 0)
r1 = a*b';
r2 = b*a';
isAlways(r1 == r2) % indeed with a warning

이 질문은 마감되었습니다.

질문:

2020년 6월 17일

마감:

2021년 8월 20일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by