Simbolic Toolbox: how to avoid conj() in matrix *

56 Ansichten (letzte 30 Tage)
Igor
Igor am 28 Dez. 2011
Beantwortet: moh ab am 26 Jun. 2019
N=10;x=0:(N-1);
syms real r;
a=r.^(x),
b=r.^(-x),
M=b'*a
Result is
a =
[ 1, r, r^2, r^3, r^4, r^5, r^6, r^7, r^8, r^9]
b =
[ 1, 1/r, 1/r^2, 1/r^3, 1/r^4, 1/r^5, 1/r^6, 1/r^7, 1/r^8, 1/r^9]
M =
[ 1, r, r^2, r^3, r^4, r^5, r^6, r^7, r^8, r^9]
[ 1/conj(r), r/conj(r), r^2/conj(r), r^3/conj(r), r^4/conj(r), r^5/conj(r), r^6/conj(r), r^7/conj(r), r^8/conj(r), r^9/conj(r)]
[ 1/conj(r)^2, r/conj(r)^2, r^2/conj(r)^2, r^3/conj(r)^2, r^4/conj(r)^2, r^5/conj(r)^2, r^6/conj(r)^2, r^7/conj(r)^2, r^8/conj(r)^2, r^9/conj(r)^2]
[ 1/conj(r)^3, r/conj(r)^3, r^2/conj(r)^3, r^3/conj(r)^3, r^4/conj(r)^3, r^5/conj(r)^3, r^6/conj(r)^3, r^7/conj(r)^3, r^8/conj(r)^3, r^9/conj(r)^3]
[ 1/conj(r)^4, r/conj(r)^4, r^2/conj(r)^4, r^3/conj(r)^4, r^4/conj(r)^4, r^5/conj(r)^4, r^6/conj(r)^4, r^7/conj(r)^4, r^8/conj(r)^4, r^9/conj(r)^4]
[ 1/conj(r)^5, r/conj(r)^5, r^2/conj(r)^5, r^3/conj(r)^5, r^4/conj(r)^5, r^5/conj(r)^5, r^6/conj(r)^5, r^7/conj(r)^5, r^8/conj(r)^5, r^9/conj(r)^5]
[ 1/conj(r)^6, r/conj(r)^6, r^2/conj(r)^6, r^3/conj(r)^6, r^4/conj(r)^6, r^5/conj(r)^6, r^6/conj(r)^6, r^7/conj(r)^6, r^8/conj(r)^6, r^9/conj(r)^6]
[ 1/conj(r)^7, r/conj(r)^7, r^2/conj(r)^7, r^3/conj(r)^7, r^4/conj(r)^7, r^5/conj(r)^7, r^6/conj(r)^7, r^7/conj(r)^7, r^8/conj(r)^7, r^9/conj(r)^7]
[ 1/conj(r)^8, r/conj(r)^8, r^2/conj(r)^8, r^3/conj(r)^8, r^4/conj(r)^8, r^5/conj(r)^8, r^6/conj(r)^8, r^7/conj(r)^8, r^8/conj(r)^8, r^9/conj(r)^8]
[ 1/conj(r)^9, r/conj(r)^9, r^2/conj(r)^9, r^3/conj(r)^9, r^4/conj(r)^9, r^5/conj(r)^9, r^6/conj(r)^9, r^7/conj(r)^9, r^8/conj(r)^9, r^9/conj(r)^9]

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 28 Dez. 2011
try use
syms r real
...
M=b.'*a
  8 Kommentare
Yildirim Dirik
Yildirim Dirik am 16 Mai 2019
Many thanks for your help. For below case, how can I define the every variable as real in the variable vecor 'a' ?
a = sym('a',[1,12])';
Yildirim Dirik
Yildirim Dirik am 16 Mai 2019
Found it! a = sym('a',[1,12],'real')';

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

moh ab
moh ab am 26 Jun. 2019
hi my friends
i have problem in result of equetion .
in my code
syms te1 te2 ted1 ted2
q=[cos(te1+te2) -sin(te1+te2) 0;...
sin(te1+te2) cos(te1+te2) 0;...
0 0 1]
q1 =
[ -sin(te1 + te2), -cos(te1 + te2), 0]
[ cos(te1 + te2), -sin(te1 + te2), 0]
[ 0, 0, 0]
q2 =
[ -ted2*sin(te1 + te2), -ted2*cos(te1 + te2), 0]
[ ted2*cos(te1 + te2), -ted2*sin(te1 + te2), 0]
[ 0, 0, 0]
t=q1+q2
z=t*.q'
the z(1,1)=0
but in result of matlab show
sin(te1 + te2)*(ted1*cos(te1 + te2) + ted2*cos(te1 + te2)) - cos(te1 + te2)*(ted1*sin(te1 + te2) + ted2*sin(te1 + te2))
how can i fix it ?

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by