Effacer les filtres
Effacer les filtres

Symbolic transpose of a matrix with the dimension not defined

1 vue (au cours des 30 derniers jours)
Álvaro
Álvaro le 7 Avr 2016
Hello,
I am trying to work with symbolic variables in Matlab but I have a little problem. I want to work with general expressions without specify the dimensions of the matrix. For example if I define A as a symbolic variable and I use "transpose(A)" I want to receive "transpose(A)" and not this:
>> syms A
transpose(A)
ans =
A
>> A = sym('a',[3 3]);
transpose(A)
ans =
[ a1_1, a2_1, a3_1]
[ a1_2, a2_2, a3_2]
[ a1_3, a2_3, a3_3]
I have a huge expression that I want to simplify later with the command "simplify".
Thank you in advance, Álvaro

Réponses (1)

Walter Roberson
Walter Roberson le 7 Avr 2016
Perhaps define a symbolic function Tr(M) without giving a definition for it, and apply it as needed. When it comes time to substitute actual matrix dimensions for A, you can also substitute a transpose function for Tr which would trigger the transposes.
  2 commentaires
Álvaro
Álvaro le 8 Avr 2016
great! it is working in the way that I want. Thank you for your answer.
I have now another issue. I have a really long symbolic expression that i want to contract using the function horner. Unfortunately it is not working for me and I dont now why. For example when I try do something like this it works
>> syms x y
>> f = x*x + x*y + x*x*x
f =
x^3 + x^2 + y*x
>> horner(f)
ans =
x*(y + x*(x + 1))
>>
but with my expression that it's really similar it doesn't contract the expression. Can you help me?
Thank you again
Walter Roberson
Walter Roberson le 8 Avr 2016
horner cannot do much unless it finds something that looks like a monomial . It does not take much to throw off horner.
Often more useful than horner() is collect()
But I would need to see more of the structure of your expression to say more.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by