Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Volume creation

Tags:

matlab

volume

I have a database as such:

  • d(:,1) = longitude
  • d(:,2) = latitude
  • d(:,3) = depth
  • d(:,4) = toxic metal concentration.

The data is irregularly spaced, and as you can see, all data are vector data. Could you please tell me how to make a volume where all the metal concentrations are plotted as color (so that easily identifiable where it is high or low) while longitude, latitude, and depth would be in the x-axis, y-axis, and z-axis respectively?

I know I have to make my d(:,4) = volume data (3D matrix which must correspond to lat, long and depth data). But I’m unsure how to create that 3D array...

like image 624
ToNoY Avatar asked Dec 04 '25 16:12

ToNoY


1 Answers

Try scatter3(X,Y,Z,S,C) (see doc)

X,Y,Z is self-explanatory. S is size of markers, and C the color; you can vary either according to your data.

Please, give it a try, and update your question if you encounter difficulties.


Update 1: Thanks to your comments I think that you want to interpolate the data on a regular grid, and slice the data.

% create a regularly spaced mesh between the exterma of the dataset
xx = linspace(min(d(:,1)),min(d(:,1)),100);
yy = linspace(min(d(:,2)),min(d(:,2)),100);
zz = linspace(min(d(:,3)),min(d(:,3)),100);

[xi,yi,zi] = meshgrid(xx, yy, zz);

% interpolate the data in the regular space
vi = interp3(d(:,1), d(:,2), d(:,3), d(:,4), xi, yi, zi, 'spline');

% choose the slice planes
xslice = [-10 10]; yslice = 0; zslice = [-100, -50, -10];

% display the sliced interpolated data
slice(xi,yi,zi,vi,xslice,yslice,zslice);

Look up the functions in the help (you may need to tune up the parameters).

But next time: try something yourself and post your attempt. It's much easier to help, plus you'll learn more.

like image 187
Hugues Fontenelle Avatar answered Dec 07 '25 16:12

Hugues Fontenelle