Griddata doesn't reach sample points
Show older comments
Hello, I have 3 vectors I am using griddata to interpolate. The problem is that the sample points are not included in the griddata output as seen in the sample red dots in the image '20'; 20 corresponds to the amount of space between the points of linspace. If I increase this to 100 the sample points are eventually reached, but the resulting image is very crowded.
Any advice on how to get griddata to reach the sample points for a lower amount of linspace points?
Thanks
N = 20; %vs e.g.100
x = [8.53315129274914,9.30925339785209,8.53315129274914,9.30925339785209,9.30925339785209,9.30925339785209,9.30925339785209,4.45216152440796,3.79261956232135,3.79261956232135,17.0677590031963,17.0677590031963,4.09601048577567,5.68892934348203];
y = [1.32520094900129,1.32154631465502,1.19462692171560,1.24730173230503,1.10676794920524,1.09225969341119,0.815136578214699,0.757268342808360,1.01606958162158,0.942815599343300,0.675121536953220,0.693923408467932,1.15323471371613,1.62262286756171];
xvec = linspace(min(x), max(x), N);
yvec = linspace(min(y), max(y), N);
[X, Y] = meshgrid(xvec, yvec);
data = [53.3523658491640,73.0221175190515,66.4448159677658,53.0481929355336,34.9019870840489,27.0340993276701,388.109339785705,341.752595986306,561.738449969976,481.741285644030,93.8209397136714,36.7262731504483,538.496713957595,820.698548835111];
Z = griddata(x,y,data,X,Y);
figure
surf(X,Y,Z)
view(2)
hold on
plot3(x,y,data,'r.','MarkerSize',20)
Accepted Answer
More Answers (0)
Categories
Find more on Data Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!