how can I make grids on an inclined surface?
5 次查看(过去 30 天)
显示 更早的评论
Hello All
I want to make grids on an inclined surface and store all the X, Y and Zs in a matfile. I wrote the following codes but when I plot, it is not a surface. how can I do this
Thank you
clear all
clc
strike_min=-200;
strike_max=200;
ddip_min=0;
ddip_max=300/cosd(10);
z_min=0;
z_max=300*tand(10);
interval=20;
strike=strike_min:interval:strike_max;
downdip=ddip_min:interval/cosd(10):ddip_max;
depth=z_min:interval:z_max;
[X,Y,Z] = meshgrid(strike, downdip,depth);
alongStrike = X(:);
downDip = Y(:);
Depth=Z(:);
% plot(alongStrike,downDip,'b.');
plot3(alongStrike,downDip,Depth,'b.');
axis ij
xlabel('along strike'); % // Label the X and Y axes
ylabel('downdip');
title('base for slipvelocity');
box on
2 个评论
Walter Roberson
2018-6-24
This does not create an inclined grid.
I recommend that you first create a non-inclined grid, and then rotate the points using a transformation matrix.
回答(1 个)
Walter Roberson
2018-6-24
N = 20;
[X, Y, Z] = ndgrid(1:N);
tform = makehgtform('scale', [400/N, 300/cosd(10)/N, 300*tand(10)], 'translate', [-200, 0, 0], 'xrotate', -10*pi/180);
XYZ = [X(:), Y(:), Z(:), zeros(numel(X),1)];
XYZt = XYZ * tform;
Xt = reshape(XYZt(:,1), size(X));
Yt = reshape(XYZt(:,2), size(Y));
Zt = reshape(XYZt(:,3), size(Z));
scatter3(Xt(:), Yt(:), Zt(:))
xlabel('strike')
ylabel('dip')
zlabel('depth')
set(gca, 'zdir', 'reverse')
另请参阅
类别
在 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!