Trying to plot x,y, but it says error in y = f(x);
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jovos
le 17 Mar 2016
Réponse apportée : Star Strider
le 17 Mar 2016
function graph
x = 1:100;
y = f(x);
plot(x,y);
end
function [y] = f(n)
y = n * log2(n);
end
0 commentaires
Réponse acceptée
Star Strider
le 17 Mar 2016
You need to use element-wise operations in this line:
y = n .* log2(n);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh 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!