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

4 vues (au cours des 30 derniers jours)
Le Dung
Le Dung le 13 Avr 2017
Commenté : Star Strider le 9 Mai 2017
my code:
x=-pi:0.1:pi;
y=abs(sin(3*x)/sin(x/2));
plot(x,y);

Réponse acceptée

Star Strider
Star Strider le 13 Avr 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 commentaires
Le Dung
Le Dung le 9 Mai 2017
Thank you so much
Star Strider
Star Strider le 9 Mai 2017
My (our) pleasure.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by