Symbolic Math trigonometry simplification
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I wrote a mfile code using the symbolic math toolbox.
xd=147;
xq=-85;
w0=377;
syms a d q w t
b=d*cos(w*t+(4*pi/3))-q*sin(w*t+(4*pi/3));
xb1=subs(b,[d,q,pi,w],[xd,xq,3.14,w0]);
simplify(xb1)
However, this simply displays the answer--- -147*cos(377*t+314/300)-85*sin(377*t+314/300)
I want to (1)extract the angle (ie.. 314/300) from this expression and (2)want to express answer in the form of cos(377t+theta)
How may I do this?
Thank you.
댓글 수: 0
답변 (1개)
Walter Roberson
2011년 10월 9일
I recommend that you use MuPad's op() to pull apart the expression, perhaps in connection with indets().
The expression as a whole cannot be expressed as in the form A*cos(B*t+theta) .
Note: pi is not a symbol in what you have constructed, so 4*pi/3 would be numerically expanded in the construction of b. There would thus be no symbol pi and no constant equal to pi available to substitute 3.14 for pi.
When you are working with trig, it is best to use symbolic forms unless that is impractical. For example, sin(4*pi/3) might come out differently than sin(sym('4*pi/3')) because the first would have to deal with round-off error but the second would not.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!