how to remove or hide streamlines outside the boundary

3 views (last 30 days)
Hi, How can i remove or hide the streamlines outside the boundary of semi circle, the method of interpolation used is griddata. following is the code and the picture showing contour for streamfunction.
% -- Eckpunkte (vertices)------------------------
plot(-1,-1,'w.'), hold on
plot(21,6,'w.'), hold on
for I = 1:size(RAND,2)
A = [p(1,RAND(1,I));p(1,RAND(2,I))];
B = [p(2,RAND(1,I));p(2,RAND(2,I))];
plot(A,B,'r','linewidth',2), hold on
end
X = p(1,:); Y = p(2,:); Z1 = zeros(1,length(X));
xlin = linspace(min(X),max(X),20);
ylin = linspace(min(Y),max(Y),20);
[U1,V1] = meshgrid(xlin,ylin);
W1 = griddata(X,Y,Z1,U1,V1,'cubic');
%trimesh(t(1:3,:)',X,Y,Z1,'edgecolor','y'), hold on
for I = 1:size(RAND,2)
A = [p(1,RAND(1,I));p(1,RAND(2,I))];
B = [p(2,RAND(1,I));p(2,RAND(2,I))];
plot(A,B,'r','linewidth',2,'erasemode','none'), hold on
end
switch bilda
case 1, disp(' Contour for Z ')
W1 = griddata(X,Y,Z,U1,V1,'v4');
[C,h] = contour(U1,V1,W1,[4,3,2,1,0.5,0.1,0.05,0.01],'k','linewidth',2);
%clabel(C,h,'labelspacing',1000)
%clabel(C,h,'manual','fontsize',15)
[C,h] = contour(U1,V1,W1,[0,-0.001,-0.005,-0.01,-0.05,-0.1,-0.3,-0.5,],'r');
%clabel(C,h,'labelspacing',1000)
%clabel(C,h,'manual','fontsize',10)
%weisseln(p,RAND,t)

Answers (0)

Categories

Find more on Interpolation 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!