3d Surface chat, limit then extent the Z axis

11 views (last 30 days)
Sam
Sam on 16 Sep 2013
Answered: DGM on 26 Mar 2024 at 13:33
Hi all
I am trying to create a 3d surface graph to show the hight of chips on a pcb board. I have all the XYZ values and have got them set as 3 variable and have created a surface chat from that.
using the command: axes equal and now righted the stretching that was occurring, however as my X&Y values are much larger than my Z values the Z axes is now effectively flat(the colour chart shows different colours) but you cant see the variation in height. Id there a way to keep the X&Y as they are (without the stretching distortion) but to increase the Z axis?
Thanks in advance
Sam

Answers (1)

DGM
DGM on 26 Mar 2024 at 13:33
In lieu of irrelevant AI-generated link spam, consider the example:
% fake xyz data
n = 100;
x = linspace(0,100,n); % x is 100 units wide
y = linspace(0,250,n); % y is 250 units wide
[X Y] = meshgrid(x,y);
Z = zeros(size(X));
Z(25:50,25:50) = 2;
Z(75:90,75:90) = 4; % tallest z feature is only 4 units
% plot it
hs = surf(X,Y,Z);
hs.EdgeAlpha = 0.5;
% set the aspect ratio
% z-features are scaled 10x WRT x or y
% but x and y are 1:1 WRT each other
zsc = 10;
set(gca,'dataaspectratio',[zsc zsc 1])

Community Treasure Hunt

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

Start Hunting!