how can I make grids on an inclined surface?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 24 Jun. 2018
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.
Antworten (1)
Walter Roberson
am 24 Jun. 2018
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')
1 Kommentar
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!