why do I get a strange result with griddata cubic?

7 ビュー (過去 30 日間)
Valeria Leto
Valeria Leto 2021 年 7 月 26 日
コメント済み: Valeria Leto 2021 年 7 月 30 日
Hi! I used the griddata cubic interpolation for the values of an image. I get this image that has a much higher range, from -300 to 400 aproximately. The non processed image has a range from 90 to 130. Any ideas why this happens?Thanks!
  3 件のコメント
Valeria Leto
Valeria Leto 2021 年 7 月 27 日
u=[-20:0.05 :20];%5 cm
v=[0:-0.05:-20];
[Xq,Yq] = meshgrid(u,v);
Zq=zeros(length(v),length(u));
figure(30)
mesh(Xq,Yq,Zq)
view(2)
% Interpolazione con griddata: CUBIC
vq_4 = griddata(x,y,C,xq,yq,'cubic');
Unrecognized function or variable 'x'.
V_4=zeros(length(v),length(u));
for i=1:1:length(v)
V_4(i,:)=vq_4(1+(i-1)*801:1+(i-1)*801+800,1)';
end
%% PLOT
figure(34)
surf(Xq,Yq,Zq,V_4,'EdgeColor','none')
title('INTERPOLAZIONE CUBIC RISOLUZIONE 5 cm')
colormap gray
colorbar
axis equal
xlabel('est')
ylabel('nord')
% view(2)
Matt J
Matt J 2021 年 7 月 27 日
The code you've posted does not run, I'm afraid:
Unrecognized function or variable 'x'.
Error in test (line 12)
vq_4 = griddata(x,y,C,xq,yq,'cubic');

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2021 年 7 月 27 日
This is expected behavior when there are sharp edges, especially with a surrounding flat area.
B--
|
-A-
Especially if the region near B is dense, but the edge itself is sparse, then the polynomial generated near the edge needs to mathematically dip down below the base in order to gain the necessary steepness to match the flat control points to the left together with the high points to the right. Polynomials cannot just suddenly rise steeply without a leading edge, so the math needs to insert a downward edge to be able to rise from.
  9 件のコメント
Bruno Luong
Bruno Luong 2021 年 7 月 30 日
working with xs/ys instead of x/y
xs = sx*x
ys = sy*y
sx, sy are appropriate scaling factors that you have to figure it out.
Valeria Leto
Valeria Leto 2021 年 7 月 30 日
@Bruno Luong thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by