Compute trig. function in symbolic matrix

Hi,
I have a symbolic matrix (as shown below). I would like for matlab to compute the trig functions with non-th5 values. How do I go about this.
Thanks in advance.
[ cos(th5), -sin(th5), 0, 0]
[ cos(90)*sin(th5), cos(90)*cos(th5), -sin(90), 0]
[ sin(90)*sin(th5), sin(90)*cos(th5), cos(90), 0]
[ 0, 0, 0, 1]

 채택된 답변

Walter Roberson
Walter Roberson 2015년 10월 30일

0 개 추천

Are you referring to reducing the sin(90) and cos(90) to the corresponding constant values? Because if you are then you need to take into account that sin() and cos() operate in radians, not in degrees. But this is your purpose then vpa() the symbolic matrix.
If you are wanting to substitute a numeric value for th5 then use subs(), possibly in conjunction with vpa() or double()
subs(TheMatrix, th5, 1.238343) %put in a particular numeric value

댓글 수: 2

Sam Ade
Sam Ade 2015년 10월 30일
편집: Sam Ade 2015년 10월 30일
Hi, thank you for your answer. I was hoping I could compute the trig. functions in degrees while still keeping the other symbolic trig. functions so I can reduce the matrix. I mean to have something like this [ cos(th5) -sin(th5) 0 0; 0 0 -1 0;sin(th5) cos(th5) 0 0;0 0 0 1]
You can call sind() or cosd() in a symbolic expression, provided it is at the MATLAB level (not in a string that has been passed to solve() or the like.)

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

질문:

2015년 10월 30일

댓글:

2015년 10월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by