How do I apply operations to a symbolic array?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ash ash
el 30 de Nov. de 2017
Editada: Walter Roberson
el 30 de Nov. de 2017
Hi all,
I am preparing a program for symbolic Geometric Algebra computation and I am facing a problem that requires your help. My vectors will be represented in matrix form and there are many operations that need to be performed.
For example when matrix A is a double array:
A=[1 2 0; 4 0 6];
A>0
returns a logical matrix
[1 1 0;1 0 1]
However, when I set the following symbolic matrix:
syms C
a=sym(A);
a(1)=C;
a=[ C, 2, 0]
[ 4, 0, 6]
How do I apply an operation to this symbolic matrix to return the following logical matrix?
[1 1 0;1 0 1]
Thank you for your help.
2 comentarios
Karan Gill
el 30 de Nov. de 2017
Adding to the answer, use assumptions, then isAlways: https://www.mathworks.com/help/symbolic/assumptions-for-symbolic-objects.html
Respuesta aceptada
Star Strider
el 30 de Nov. de 2017
Use the isAlways function:
syms C
A = sym([1 2 0; 4 0 6]);
L = isAlways(A > 0)
L =
2×3 logical array
1 1 0
1 0 1
However:
syms C
A = sym([1 2 0; 4 0 6]);
A(1,1) = C;
L = isAlways(A > 0)
produces:
Warning: Unable to prove '0 < C'.
> In symengine
In sym/isAlways (line 38)
In Elipses (line 79024)
L =
2×3 logical array
0 1 0
1 0 1
while setting a condition on ‘C’ produces:
syms C
assume(C, 'positive')
A = sym([1 2 0; 4 0 6]);
A(1,1) = C;
L = isAlways(A > 0)
L =
2×3 logical array
1 1 0
1 0 1
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Assumptions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!