Meshgrid for logarithmic scales
39 次查看(过去 30 天)
显示 更早的评论
I would like to make 3-D plot using mesh in which one axis should be on a logarithmic scale. Is there a way to use meshgrid and mesh to do this?
Thanks.
0 个评论
采纳的回答
Sean de Wolski
2011-12-21
Set the corresponding scale to 'log'
h = figure;
A = axes;
surf(magic(10));
set(A,'XScale','log')
The explanation is in:
docsearch axes properties
under xscale/yscale/zscale
0 个评论
更多回答(2 个)
Rishabh Gupta
2017-10-15
If you are using mesh command, just use the following:
Set(gca,'XScale','log');
0 个评论
Walter Roberson
2011-12-21
It is not supported to set the [XYZ]Scale to 'log' if you are using transparency. I do not recall at the moment which of the settings takes priority.
If any of your coordinates on the log scale are 0 or less, then those points will be ignored with [XYZ]Scale is 'log', and nothing will be drawn to those points (in particular, no interpolation of the adjacent points towards the axis limit will be done.)
As far as I recall at the moment, it is allowed to use mesh with an axis set to log scale.
Are you perhaps attempting to use meshgrid to create points that will show up as-if linearly spaced when the axis is set to log scale? If so, then yes, just use exp(ThePoints) or 10.^(ThePoints) as the corresponding meshgrid argument.
Are you perhaps attempting to use meshgrid to create points that will show up as-if spaced logarithmically when the axis is set to linear -- faking a log scale? If so, then yes, just use ln(ThePoints) or log10(ThePoints) as the corresponding meshgrid argument (and watch out for original points <= 0)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!