Symbolic Math trigonometry simplification
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Walter Roberson
el 9 de Oct. de 2011
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 comentarios
Ver también
Categorías
Más información sobre Assumptions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!