I am trying to create a surface plot with nested loops and am getting the error "Z must be a matrix, not a scalar or vector."

 Respuesta aceptada

G A
G A el 22 de Abr. de 2019
Editada: G A el 24 de Abr. de 2019
Try something like the following (z must be a matrix):
for m = 1:10
x(m) = m;
for n = 1:10
y(n) = n;
z(m,n) = n+m;
end
end
surf(x,y,z)

Más respuestas (0)

Productos

Versión

R2019a

Preguntada:

el 22 de Abr. de 2019

Editada:

G A
el 24 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by