Surface plot ignores points when using log scale
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Daniel
el 10 de Oct. de 2016
Editada: David Goodmanson
el 10 de Oct. de 2016
I'm plotting data using surf and find that some data points seem to be ignored when I have the z-axis in log scale versus linear. In the code for example, the point at G(9,7) clearly shows up on the linear plot but there is a blank square when in log mode. Switching between log and linear mode on the plot with the "flat" orientation shows points disappearing when going to log.
I've tried using NaN instead of zero but still don't get the results I want. Using Mesh seems to do the same thing.
0 comentarios
Respuesta aceptada
David Goodmanson
el 10 de Oct. de 2016
Editada: David Goodmanson
el 10 de Oct. de 2016
Hi Daniel, You are of course going to get some infs in your log plot since log(0) = -inf. Take a look at
x = 1:10;
y = 1:10;
[xx yy] = meshgrid(x,y);
zz = xx+yy;
figure(1); surf(xx,yy,zz)
zz(5,6) = inf; figure(2); surf(xx,yy,zz)
zz(5,6) = nan; figure(3); surf(xx,yy,zz)
Matlab cuts out tiles that have a corner value of inf or NaN.
So, for the log plot you could replace the zeros with a value like 1e-6 or whatever works. For plots that really do contain inf, I don't know if there is anything you could do. Maybe somebody else will. At least if you want to make a 3d model of a house, it will be easy to do the windows.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!