How can I plot loglog(x,y) with experimental data including negative and less than one
Mostrar comentarios más antiguos
I tried to plot a big set of experimental data which in 'x' axis ranges from negative data to positive, and also includes data less and more than 1.0. if I use loglog(abs(x),y) , obviously it draws both negative and positive 'x' values in one side, but I want to keep sign of 'x' values while converting to log scale. Also tried to define xlog = sign(x).*log10(abs(x)); but problem didn't solve, it is not like loglog. Any comments please how to do that?? Thanks
1 comentario
Thomas Koelen
el 24 de Abr. de 2015
Whay do you mean by keeping the sign of the x values? you can't plot negative values on a loglog scale.
Respuesta aceptada
Más respuestas (2)
MD
el 24 de Abr. de 2015
There is no side (as a reference to zero) on a log scale. You can try separating your x into negatives and positives. And then plot log of absolute values on two separate graphs.
xPositive = x(x>0);
yPositive = y(x>0);
xNegative = abs( x(x<0) );
yNegative = y(x<0);
figure(1)
semilogx(xPositive, yPositive);
figure(2)
semilogx(xNegative, yNegative);
1 comentario
Ray
el 24 de Abr. de 2015
Ray
el 24 de Abr. de 2015
0 votos
Categorías
Más información sobre Log Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!