Surface plot ignores points when using log scale
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Daniel
am 10 Okt. 2016
Bearbeitet: David Goodmanson
am 10 Okt. 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 Kommentare
Akzeptierte Antwort
David Goodmanson
am 10 Okt. 2016
Bearbeitet: David Goodmanson
am 10 Okt. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!