Extrapolation for a contour plot
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I have a table XYZ named p3d with three columns (xyz) as below:
2139.36236643955 1206.78565433912 3
2066.17058682721 1205.71920426345 4
1992.97880721486 1206.78565433912 4
1902.70894569297 1209.98500456615 -4
1806.33976920338 1208.91855449048 -14
1720.06006488482 1209.65685130956 -45
2045.27086002642 1431.37983116559 -9
2090.50691274803 1361.30522065203 -7
2124.63235602924 1316.20769903440 5
2165.10671899068 1266.94732926745 -5
2267.67427744254 1099.98622837556 -17
2119.82902977040 1107.47909052381 -14
1940.91485323962 1107.47909052381 -7
1932.34411424413 1016.62813697632 -13
and want to visualize data in such a way:

I've interpolated my data with griddata, but it doesn't have extrapolation method. Command griddedInterpolant can do this, but it demands matrix for 2D case - and I have only vector.
Is extrapolation of data from correct way to obtain desired values?
How can I restrict matlab to plot in a redundant area?
How to overlay background image and a graph (now graph is just over the background)?
Now my code is:
img_an = 'KSM11.png';
img = imread(img_an);
limits = size(img);
% Draws initial grid maximizing its size
sz=get(0,'ScreenSize');
fig=figure('position',[sz(1) sz(2) sz(3) sz(4)]);
xlabel('X','FontWeight','bold','FontSize',14)
ylabel('Y','FontWeight','bold','FontSize',14)
xlim([0 limits(2)]);
ylim([0 limits(1)]);
grid on
hold on
imagesc(flipud(img));
x = p3d(:,2); % first column is reserved
y = p3d(:,3);
v = p3d(:,4);
[xq,yq] = meshgrid(0:1:limits(2), 0:1:limits(1));
vq = griddata(x,y,v,xq,yq);
% mesh(xq,yq,vq)
% [xx,yy] = ngrid(x,y)
% vq = griddedInterpolant(xx,yy,v,'linear','linear'); smth is wrong
[C,h] = contourf(xq,yq,vq);
clabel(C,h)

0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!