Filtering data from interpolated points on patch
Mostra commenti meno recenti
Hi,
The problem would be:
In the figure below, there are 6 points (xy) and the values (q) are assigned to these points. From these points, 3 triangles, colored by value, are drawn using the PATCH command.
By interpolating along two vertical lines I have determined 10-10 values. However, my problem is that it also interpolates values to places where there is no colored triangle (only white background).
Is there any way to zero out all the interpolated values that do not fall on the colored areas?
(This just demonstrates a simpler scenario, there are where I need to filter out these points for a model with many more triangles and white areas.)
The programme can be found below.
FIGURE:

PROGRAM:
xy = [1 3.1
2.6 2.8
1.3 1.9
2.8 1.5
3.7 2.1
2 0.9];
Connectivity_matrix = [3 2 1
5 2 4
6 4 3];
q = [1 2 3 1 2 3]';
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];
I = scatteredInterpolant(xy,q);
[x,y] = meshgrid([1.7; 2.4],linspace(0.8,3.2,10));
v = I(x,y)
figure ()
set(gcf, 'color', 'w')
colormap(RGB);
colorbar('EastOutside')
patch('Faces',Connectivity_matrix,'Vertices', xy,'FaceVertexCData',q,'FaceColor','interp')
axis equal
str = compose('%.3f ',v);
text(x(:),y(:),str(:),'HorizontalAlignment','right','BackgroundColor','w')
line(x(:),y(:),'LineStyle','none','Marker','o','Color',[0.75 0 0.75],'MarkerFaceColor',[0.75 0 0.75])
Do you have any idea how can I solve this problem?
Thank you so much for your helpful comments!
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Multirate Signal Processing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

