필터 지우기
필터 지우기

how can I make grids on an inclined surface?

조회 수: 3 (최근 30일)
Samaneh Arzpeima
Samaneh Arzpeima 2018년 6월 24일
댓글: Samaneh Arzpeima 2018년 6월 25일
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
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.
Samaneh Arzpeima
Samaneh Arzpeima 2018년 6월 24일
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!

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
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')
  댓글 수: 1
Samaneh Arzpeima
Samaneh Arzpeima 2018년 6월 25일
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');

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by