Matlab interpolation between two surfaces

조회 수: 13 (최근 30일)
Thibaut Gerson
Thibaut Gerson 2021년 1월 15일
답변: Star Strider 2021년 1월 15일
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에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by