Borrar filtros
Borrar filtros

i got an error when i run this code ?

2 visualizaciones (últimos 30 días)
mohamed
mohamed el 14 de Mzo. de 2013
x=(1:100); for k=1:5 y(:,k)=k*log(x); end plot(x,y)
the error is in the third line? i want to make a single plot for different values of k

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 14 de Mzo. de 2013
Editada: Andrei Bobrov el 14 de Mzo. de 2013
k = 1:5;
x = 1:100;
y = k'*log(x);
plot(x,y);
  2 comentarios
mohamed
mohamed el 14 de Mzo. de 2013
you really got what i want but did you find the error in my code ??
Andrei Bobrov
Andrei Bobrov el 14 de Mzo. de 2013
see Wayne's answer

Iniciar sesión para comentar.

Más respuestas (1)

Wayne King
Wayne King el 14 de Mzo. de 2013
Editada: Wayne King el 14 de Mzo. de 2013
x=(1:100); for k=1:5 y(:,k)=k*log(x); end, plot(x,y)
You forgot a semicolon, or comma after end
or better yet:
x=(1:100);
for k=1:5
y(:,k)=k*log(x);
end
plot(x,y)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by