how can I make grids on an inclined surface?

7 visualizzazioni (ultimi 30 giorni)
Samaneh Arzpeima
Samaneh Arzpeima il 24 Giu 2018
Commentato: Samaneh Arzpeima il 25 Giu 2018
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 Commenti
Walter Roberson
Walter Roberson il 24 Giu 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.
Samaneh Arzpeima
Samaneh Arzpeima il 24 Giu 2018
thank you, if I change the above code like
[X,Y] = meshgrid(strike, downdip);
plot(alongStrike,downDip,'b.');
I would have a non-inclined surface, then I don't know how to rotate!

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 24 Giu 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 Commento
Samaneh Arzpeima
Samaneh Arzpeima il 25 Giu 2018
Thank you Walter I am still trying to figure out your solution,but I did run your script and it gives me not what I want. If you please check the attached file,I only want to make grids on ABFG surface and extracts their coordinates.
I did change my script,but the output graph is not still what I am looking for.
Can you please give me some more advice, I really appreciate it.
strike_min = -300;
strike_max = 300;
ddip_max = 0;
ddip_min = -300*tan(10);
interval = 20;
strike = strike_min:interval:strike_max;
downdip = ddip_min:interval/cosd(10):ddip_max;
[X,Y] = meshgrid(strike, downdip);
Z = (31738.8/180000)*X; %formula for plane,use 3points
alongStrike = X(:); %AB
downDip = Y(:); %AG
Depth = Z(:); %DG
plot3(alongStrike,downDip,Depth,'b.');
axis ij
xlabel('along strike'); % // Label the X and Y axes
ylabel('downdip');
zlabel('depth');
title('base for slipvelocity');

Accedi per commentare.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by