How to enter a function into MATLAB

1 visualización (últimos 30 días)
Nicholas Deosaran
Nicholas Deosaran el 17 de Sept. de 2020
Comentada: Walter Roberson el 17 de Sept. de 2020
Hello good day,
I am having issues on how to enter this equation into MATLAB.
I have it as
H/2 * cos(k*x)*cos(sigma*t)
but getting a different answer from my calculator
Thank you

Respuestas (1)

Steven Lord
Steven Lord el 17 de Sept. de 2020
Is your calculator computing the cosine of angles in degrees (which in MATLAB is the cosd function) or in radians (cos)?
  2 comentarios
Nicholas Deosaran
Nicholas Deosaran el 17 de Sept. de 2020
I did it in radians and degrees and got different answers.
Am I tryping out the code corretly in MATLAB?
I don't know if I need to put the .* in the function.
Walter Roberson
Walter Roberson el 17 de Sept. de 2020
If your inputs are all scalars then you can use either * or .*
If your inputs are not scalars, then you need .*

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by