필터 지우기
필터 지우기

Surface plot ignores points when using log scale

조회 수: 3 (최근 30일)
Daniel
Daniel 2016년 10월 10일
편집: David Goodmanson 2016년 10월 10일
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.

채택된 답변

David Goodmanson
David Goodmanson 2016년 10월 10일
편집: David Goodmanson 2016년 10월 10일
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개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by