Help me about plot and linspace in matlab ?
69 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nguyen Trong Nhan
le 25 Déc 2013
Commenté : Nguyen Trong Nhan
le 25 Déc 2013
for example I plot the graph y = 2/x by plot command :
x = linspace(1,10,100);
y = 2./x;
plot(x,y,'linewidth',4,'color','r')
It run normally and doesn't have error. But now I plot the graph y = (2/x)^3 by plot:
x = linspace(1,10,100);
y = (2./x)^3;
plot(x,y,'linewidth',4,'color','r')
It appear the error : ??? Error using ==> mpower Inputs must be a scalar and a square matrix. Help me fix it. I think I put the dot wrong. thanks very much.
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 25 Déc 2013
It should be
x = linspace(1,10,100);
y = (2./x).^3;
plot(x,y,'linewidth',4,'color','r')
3 commentaires
Azzi Abdelmalek
le 25 Déc 2013
If x=[1 2 3] , x^3 is not possible, what you need is x.^3, operation element by element
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Line Plots 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!