Interpolation to arbitrary points on a patch plot
显示 更早的评论
Hi,
My question is, if I have all my points on the plane and each point is assigned a specific value, how can I retrieve the values interpolated to an arbitrary point in the colored figure below?
(Perhaps better understood by running the program below after the problem I posed.)
A practical concrete example of this is shown in the PATCH figure below. If I select 2 vertical lines and enter the coordinates of 5 points equally spaced on the lines, how can I retrieve the interpolated values at those purple points?
THE PROGRAM:
%Values of points
q = [0;2.00997512422418;2.11482859825566;0;...
1.50960259671213;1.00498756211209;1.47648230602334];
RGB = [0 0 1
0 0.5 1
0 1 1
0 1 0.5
0 1 0
0.5 1 0
1 1 0
1 0.5 0
1 0 0];
% data for patch (connectivity matrices)
msh_1.nn_tria = [3,2,7;2,6,7;5,3,7;6,5,7];
msh_1.nn_quad = [5,4,1,6];
msh_1.xy = [0,0;2,0;2,1;0,1;1,1;1,0;1.5,0.5];
%% Visualisation with patch
figure (8)
set(gcf, 'color', 'w')
colormap(RGB);
colorbar('EastOutside')
patch('Faces',msh_1.nn_tria,'Vertices', msh_1.xy,'FaceVertexCData',q,'FaceColor','interp')
patch('Faces',msh_1.nn_quad,'Vertices', msh_1.xy,'FaceVertexCData',q,'FaceColor','interp')
axis equal
FIGURE:

Do you have any idea how can I solve this problem?
Thank you so much for your helpful comments!
采纳的回答
更多回答(1 个)
For example,
F=scatteredInterpolant(msh_1.xy, q);
interpolatedValues = F({[0.68,1.87],0:0.2:1})
类别
在 帮助中心 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

