% Confronto diverse interpolazione caso bidimensionale su griglia
% tensoriale.

close all
clear all
clc

[X,Y] = meshgrid(-3:.25:3);
Z = peaks(X,Y);
[XI,YI] = meshgrid(-3:.125:3);
ZI1 = interp2(X,Y,Z,XI,YI,'nearest');
ZI2 = interp2(X,Y,Z,XI,YI,'linear');
ZI3 = interp2(X,Y,Z,XI,YI,'cubic');
ZI4 = interp2(X,Y,Z,XI,YI,'spline');

figure;
mesh(X,Y,Z)

figure;
% subplot(1,2,1)
% contourf(XI,YI,ZI1,16)
% subplot(1,2,2)
mesh(XI,YI,ZI1)

figure;
% subplot(1,2,1)
% contourf(XI,YI,ZI2,16)
% subplot(1,2,2)
mesh(XI,YI,ZI2)

figure;
% subplot(1,2,1)
% contourf(XI,YI,ZI3,16)
% subplot(1,2,2)
mesh(XI,YI,ZI3)

figure;
% subplot(1,2,1)
% contourf(XI,YI,ZI4,16)
% subplot(1,2,2)
mesh(XI,YI,ZI4)
