MATLAB Answers

Matlab interpolation between two surfaces

22 views (last 30 days)
Thibaut Gerson
Thibaut Gerson on 15 Jan 2021
Answered: Star Strider on 15 Jan 2021
Good morning,
I am making this post because I am trying to create a surface resulting from the interpolation (linear, polynomial, spline or other..) between two other surfaces (same x,y grid but not same shape). Is there a way or an existing function into matlab for doing it?
The following picture gives a better understanding of what I would like to be able to do with matlab: from grey surfaces, calculate/create red surfaces..
Thanks

  0 Comments

Sign in to comment.

Answers (3)

KSSV
KSSV on 15 Jan 2021
Have a look on slice.

  1 Comment

Thibaut Gerson
Thibaut Gerson on 15 Jan 2021
Maybe I am wrong but as I understand the slice function, it requires to have all the Volume V already computed, right?
If this statement is correct, I don't think I can use the slice function since I don't know the function in between my two surfaces. This is the goal: assessing what appens in between thans to interpolation strategy.
But maybe this is impossible?
Thanks

Sign in to comment.


Bruno Luong
Bruno Luong on 15 Jan 2021
Edited: Bruno Luong on 15 Jan 2021
Assuming your two original surfaces are z1 and z2, juts pick w scalar in (0,1) interval,
zinterp = (1-w)*z1 + w*z2;
If w == 0 you'll get zinterp as z1, w==1 you'll get z2, any value of w in between gives you the intrepolation surface.

  0 Comments

Sign in to comment.


Star Strider
Star Strider on 15 Jan 2021
Experiment with this:
x = linspace(-5, 5, 20);
y = x;
[X,Y] = ndgrid(x,y);
z = @(x,y,s,h,a) a .* exp(s*(x.^2+y.^2)) + h; % Z-Plot Function
figure
surf(X, Y, z(X,Y,-0.1,10,1)) % Basic Surface (Delete)
grid on
hv = (0:1:5)*25; % Height Vector (Creates ‘Layer’ Offsets)
av = linspace(0, 50, numel(hv)); % Amplitude Vector (Amplitudes Of Different Layer Plot Heights)
figure
hold on
for k = 1:numel(hv)
hs = surf(X, Y, z(X,Y,-0.1,hv(k),av(k))); % Plot Surfaces
hs.FaceAlpha = 0.5; % Transparency
hs.EdgeColor = 'none'; % Turns Off Edge Colours
hs.FaceColor = 'r'; % Corresponds To Posted Image
if (k == 1) | (k == numel(hv))
hs.FaceColor = [1 1 1]*0.5; % Highest & Lowest Layers Are Gray
end
end
hold off
set(gca, 'Color','none', 'GridAlpha',0, 'XColor','none', 'YColor','none', 'ZColor','none') % Experiment With These Options
view(-60, 10) % Sets Viewing (Camera) Orientation
producing:
This should get you started.
I also see some other things on the lowest layer, however I cannot figure out what they are, so I leave it to you to add them.
.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!