Matlab interpolation between two surfaces

19 次查看(过去 30 天)
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

回答(3 个)

KSSV
KSSV 2021-1-15
Have a look on slice.
  1 个评论
Thibaut Gerson
Thibaut Gerson 2021-1-15
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

请先登录,再进行评论。


Bruno Luong
Bruno Luong 2021-1-15
编辑:Bruno Luong 2021-1-15
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.

Star Strider
Star Strider 2021-1-15
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.
.

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by