Borrar filtros
Borrar filtros

plot vector where negative data is circled

2 visualizaciones (últimos 30 días)
Toke Søltoft
Toke Søltoft el 13 de Mzo. de 2015
Respondida: Toke Søltoft el 13 de Mzo. de 2015
If I e.g. have the following two vectors:
data = [1 2 3 -4 -5 6 -7 8 9 -10]
pos = [1 2 3 4 5 6 7 8 9 10]
How can I do
plot(abs(data),pos)
set(gca,'xscale','log');
where only the negative data is circled? Is that even possible without stepping through each data point?

Respuesta aceptada

Rick Rosson
Rick Rosson el 13 de Mzo. de 2015
Editada: Rick Rosson el 13 de Mzo. de 2015
isNeg = (data < 0);
plot(abs(data),pos)
hold on
plot(abs(data(isNeg)),pos(isNeg),'o')
set(gca,'xscale','log');

Más respuestas (1)

Toke Søltoft
Toke Søltoft el 13 de Mzo. de 2015
thanks so much. Works like a charm.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by