Trying to plot x,y, but it says error in y = f(x);
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Jovos
el 17 de Mzo. de 2016
Respondida: Star Strider
el 17 de Mzo. de 2016
function graph
x = 1:100;
y = f(x);
plot(x,y);
end
function [y] = f(n)
y = n * log2(n);
end
0 comentarios
Respuesta aceptada
Star Strider
el 17 de Mzo. de 2016
You need to use element-wise operations in this line:
y = n .* log2(n);
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Multidimensional Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!