Interpolation of layers to obtain a layer in the orthogonal plan

2 vues (au cours des 30 derniers jours)
Ricardo Duarte
Ricardo Duarte le 21 Sep 2021
Commenté : Ricardo Duarte le 23 Sep 2021
Dear all,
I have three variables S1, S2 and S3 with the size (1000x1000) all that represent the sound levels in three different layers at three different depths. Now, I want to use those layers to calculate the sound levels in an orthogonal plan (kind of perpendicular cut of those layers), by using the interpolation of those three layers (see the figure below).
What and how can I do that?
Thank you all in advance.
  4 commentaires
Adam Danz
Adam Danz le 21 Sep 2021
In your description, it states that you have three layers at three different depths which makes the data set 3D.
If that's not the case, could you provide an explicit example?
Ricardo Duarte
Ricardo Duarte le 22 Sep 2021
Yes, I have three slices (see the file attached).
What I want is to do a cut in the perpendicular axes (cutting plan) and extract the resulting new layer.
Thank you for your help.

Connectez-vous pour commenter.

Réponse acceptée

Adam Danz
Adam Danz le 22 Sep 2021
Modifié(e) : Adam Danz le 22 Sep 2021
Load data
data1 = load('S1.mat');
data2 = load('S2.mat');
data3 = load('S3.mat');
depths = [1 5 10];
Concatenate layers to 3D array
layers = cat(3, data1.Layer1_1m_, data2.Layer2_5m_, data3.Layer3_10m_);
Select a slice along the x axis. The select the a YZ plane at x=5
xIdx = 5; % x-slice
Interpolate
yzSlice = squeeze(layers(xIdx, :, :)); % yz plane at x=xIdx
newZ = min(depths) : max(depths); % interpolated z values
sliceInterp = interp1(depths, yzSlice', newZ)'; % interplated plane
Plot results. Circles and lines (-o) are the raw data. Dots are the interpolation.
figure()
plot(depths, yzSlice', 's-')
hold on
set(gca, 'ColorOrderIndex', 1) % reset color order to match
plot(newZ, sliceInterp', '.')

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by