# Arranging of variable submatrices into main matrix results in forming cos(conj(theta))

3 views (last 30 days)
Bathala Teja on 8 Sep 2021
Commented: Bathala Teja on 8 Sep 2021
In my script, i formed matrices G_ss, G_sr, Grs, Grr(all are 3*3) in terms of theta.
i am doing differentiation operation w.r.t theta for all matrices then i am getting Gd_ss, Gd_sr, Gd_rs, Gd_rr matrices after differentiation.
Finally i am forming single matrix G = [Gd_ss Gd_sr; Gd_rs Gd_rr]
I have to get G matrix interms of theta. But in the result it is showing cos(conj(theta)), sin(conj(theta))......etc, terms instead of cos(theta), sin(theta).
Where it went wrong i dont know.
Even after differentiation operation, Gd_ss, Gd_sr, Gd_rs, Gd_rr matrices are in theta only not like conj(theta).
After forming G only it is showing conj(theta). How to rectify this??

Walter Roberson on 8 Sep 2021
Somewhere in your calculation, you have the ' (conjegate transpose) operator instead of the .' (non-conjugate transpose) operator.
If you are doing linear algebra, expecially with some kinds of physics, it is not uncommon that using ' (conjugate transpose) operator is mathematically correct. For example, you might have
W'*X*W
and if so then mathematically the conjugate transpose is typically the appropriate operator there.
Now, if you happen to be working with a system in which you are certain that none of the values can be complex-valued, then you can avoid the difficulty of seeing conj() by telling MATLAB that your symbolic variables are real-valued, such as
syms theta real
I recommend that you routinely tell MATLAB that symbolc variables are real-valued if you know that to be true: when MATLAB can reason that a value is surely real-valued then it will remove the conj()
##### 3 CommentsShow 1 older commentHide 1 older comment
Walter Roberson on 8 Sep 2021
Right, syms theta real will help.
Note that if you have any acos() or asin() then MATLAB might not be able to prove that the argument is strictly in the range -1 to +1 so you might still see a conj()
Bathala Teja on 8 Sep 2021
"syms theta real" worked.
Thank you very much

### Categories

Find more on Number Theory in Help Center and File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!