Borrar filtros
Borrar filtros

Plotting with arrays, no graph displayed

1 visualización (últimos 30 días)
Grace
Grace el 12 de Mzo. de 2023
Comentada: Star Strider el 12 de Mzo. de 2023
x = [6000,9375];
y = 10;
plot(x,y,'red')
title('x by y')
xlabel('x')
ylabel('y')

Respuesta aceptada

Star Strider
Star Strider el 12 de Mzo. de 2023
Plotting one point requres a marker, and plotting a line requires at least two vectors of the same size.
Two options, depending on the result you want —
x = [6000,9375];
y = 10;
figure
plot(x,y,'pr')
title('x by y')
xlabel('x')
ylabel('y')
x = [6000,9375];
y = 10*ones(size(x));
figure
plot(x,y,'red')
title('x by y')
xlabel('x')
ylabel('y')
And of course, you can plot both markers and lines of various kinds connecting them.
.
  2 comentarios
Grace
Grace el 12 de Mzo. de 2023
Thank for your answer, it is very helpful
Star Strider
Star Strider el 12 de Mzo. de 2023
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by