How can i convert symbolic sin function to cos
Afficher commentaires plus anciens
Hello
After looking through mathworks for answer, i found nothing that seemed helpfull. In 3 phase AC theory you nearly always want the AC waves written as a function of cos, i made a function that converts between reference frames, but in some cases it writes the symbolic function as sin and not as cos. I have tried to use collect, rewrite and simplify, but the way i used them it didnt work.
2 outputs of the function im not happy about:
[DOut_Valuesabc] = f_RefFrame(f,"SR","abc")

[DOut_Values_AB_to_SR] = f_RefFrame(DOut_Values_abc_to_AB,"AB","SR")
First one is obvious, it should be cos not sin, second one i want rewritten i as an exponential, but it also dont want to do that. Have for example tried this:
simplify(rewrite(expand(rewrite(DOut_Valuesabc, 'exp')), 'cos'))

and:
simplify(rewrite(DOut_Valuesabc,'cos'),'steps',50)

Again it does not work.
I tried to include as much as possible so any eventual helpers do not need to open my files, which could easily become very confusing.
Any feedback in asking the question is welcome since it is my first question
1 commentaire
Not exactly sure how to do it. Unsuccessful in some cases. Need to re-read documentation.
Update: 'sin' or 'cos' will perform the same thing as rewrite(y, 'sincos').
syms x
y1 = sin(x + pi/2);
sin2cos = simplify(rewrite(expand(rewrite(y1, 'tan')), 'cos'))
y2 = sin(x - pi/2);
sin2cos = simplify(rewrite(expand(rewrite(y2, 'tan')), 'cos'))
y3 = sin(x - pi/4);
sin2cos = simplify(rewrite(expand(rewrite(y3, 'tanh')), 'cos'))
help rewrite
Réponses (1)
Apeksha Bagrecha
le 21 Sep 2022
0 votes
Please refer to this link: How can I convert a symbolic expression to one suited for use by the ODExx commands in Symbolic toolbox 3.2.3 (R2008a)? - MATLAB Answers - MATLAB Central (mathworks.com)
I hope this link may be useful
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
