필터 지우기
필터 지우기

Symbolic transpose of a matrix with the dimension not defined

조회 수: 1 (최근 30일)
Álvaro
Álvaro 2016년 4월 7일
댓글: Walter Roberson 2016년 4월 8일
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

답변 (1개)

Walter Roberson
Walter Roberson 2016년 4월 7일
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
Álvaro
Álvaro 2016년 4월 8일
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 2016년 4월 8일
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.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by