Why does matlab change cos / sin input?

1 visualización (últimos 30 días)
Wouter van den Wijngaard
Wouter van den Wijngaard el 17 de Feb. de 2020
Respondida: Siriniharika Katukam el 20 de Feb. de 2020
Hello,
Something very weird happens when i try to integrate cos / sin functions. Matlab changes te values i put in the cos / sin for example this happens when i want to integrate acceleration (a) to speed (v):
>> syms x
>> a=cos(-2*x+3)
a =
cos(2*x - 3)
How can i avoid this?
  2 comentarios
John D'Errico
John D'Errico el 17 de Feb. de 2020
Why does it matter at all? cos(X) == cos(-X). So it changes nothing.
Stephen23
Stephen23 el 17 de Feb. de 2020
"Something very weird happens when i try to integrate cos / sin functions..."
Why is it weird? They are exactly equivalent.

Iniciar sesión para comentar.

Respuestas (1)

Siriniharika Katukam
Siriniharika Katukam el 20 de Feb. de 2020
Hi
Assuming that your issue is the change of signs in the "cos" function, the interpreted value of a as cos(2*x - 3) is right as "cos(x) = cox(-x)". You will get the same values when you try to integrate both cos(-2*x + 3) and cos(2*x – 3).

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by