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

81 Ansichten (letzte 30 Tage)
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]
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Andrei Bobrov am 28 Dez. 2011
try use
syms r real
...
M=b.'*a
##### 8 Kommentare6 ältere Kommentare anzeigen6 ältere Kommentare ausblenden
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 am 16 Mai 2019
Found it! a = sym('a',[1,12],'real')';

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

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 ?
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Code Generation 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