Info

This question is closed. Reopen it to edit or answer.

How to do matrix equality testing for symbols?

2 views (last 30 days)
Ivor Horton
Ivor Horton on 17 Jun 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
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?

Answers (1)

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

Community Treasure Hunt

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

Start Hunting!