Plot 3D data on a 2D profile
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have a dataset which roughly resembles a plane with dip direction 331 degrees. I want to generate a 2D plot where the x-axis is dip direction, and not generic x-coordinate. In this way the 2D profile will most clearly illustrate the planar feature.
My dataset is [x,y,z] for 100+ points. How can I rotate a 2D Z vs X plot to instead be Z vs Dip Direction?
Thank you
0 Commenti
Risposte (1)
Jacob Mathew
il 4 Dic 2024
Hi ZigzS,
You can tranform the data set by rotation it around the Z axis by the required degree of dip. Post this, you can plot the rotated data for further analysis. Here is an example script:
% Sample dataset
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
y = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
z = [1.1, 2.3, 3.0, 4.1, 5.2, 6.1, 7.3, 8.0, 9.2, 10.1];
data = [x', y', z'];
% Plotting original data for reference
figure;
subplot(1, 2, 1);
plot3(x, y, z, 'o');
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Original 3D Data');
grid on;
axis equal;
% Dip direction in degrees
dip_direction_deg = 331;
% Convert dip direction to radians
theta = deg2rad(dip_direction_deg);
% Rotation matrix for rotation around the Z-axis
R = [cos(theta), -sin(theta), 0;
sin(theta), cos(theta), 0;
0, 0, 1];
% Rotate the data
rotated_data = (R * data')';
% Extract the new x-coordinates and z-coordinates
new_x = rotated_data(:, 1);
z = rotated_data(:, 3);
% Plotting rotated data
subplot(1, 2, 2);
plot(new_x, z, 'o');
xlabel('Dip Direction');
ylabel('Z');
title('2D Profile Aligned with Dip Direction');
grid on;
axis equal;
We utilise the deg2grad function to convert the dip direction from degrees to radians. The link to its documentation is as follows:
0 Commenti
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!