why can't i draw diagram of function abs(sin3x/sin(x/2)) in matlab?

3 visualizaciones (últimos 30 días)
my code:
x=-pi:0.1:pi;
y=abs(sin(3*x)/sin(x/2));
plot(x,y);

Respuesta aceptada

Star Strider
Star Strider el 13 de Abr. de 2017
Because you are not using element-wise division (with the ‘dot’ operator, as ‘./’).
This works:
x=-pi:0.1:pi;
y=abs(sin(3*x)./sin(x/2));
plot(x,y);
See the documentation on Array vs. Matrix Operations for all the details.
  7 comentarios

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical 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