Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Plotting a data from a matrix

1 visualización (últimos 30 días)
Suchetana Gupta
Suchetana Gupta el 2 de Jun. de 2015
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hi I have a matrix where there are 11 rows and 198 columns. The values range between -1 to +1. I would like to plot the values (1 to 198 on x axis and 11 (random 11 sets)) in such a way that the positive values get red colour and the negative values get blue colour. How do I go about it? Thanks

Respuestas (1)

Walter Roberson
Walter Roberson el 2 de Jun. de 2015
colidx = 1 + (YourMatrix >= 0);
surf(YourMatrix, colidx);
colormap([0 0 1; 1 0 0]); %blue; red
If you are thinking of a line plot then you need to define what should happen for lines that go between positive and negative points. You might want
mesh(YourMatrix, colidx);
  1 comentario
Suchetana Gupta
Suchetana Gupta el 2 de Jun. de 2015
Editada: Suchetana Gupta el 2 de Jun. de 2015
@Walter I am not looking for this. What I am looking for is something like what I have attached in the image.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by