Streamslice for non-rectangular plane

9 次查看(过去 30 天)
Andreas Frederiksen
回答: BhaTTa 2024-11-28,4:23
When trying to plot the streamlines in a non-rectangular domain using the streamslice function, the streamslice function plots the streamlines in a rectangular domain which is defined by the corner-coordinates in X and Y. Any datapoints outside of this rectangular domain are not included, and any areas where there is no data is interpolated. Is there any way to specify the shape of the domain which the stramslice function should use when plotting the streamlines?
The following illustrates the problem.
figure
[X,Y] = meshgrid([0:4],[0:4]);
Ynew = Y + (X-2).^2;
streamslice(X,Ynew,ones(5,5),ones(5,5))
The domain is 'parabolic' but streamlines are plotted in a rectangular domain.

回答(1 个)

BhaTTa
BhaTTa 2024-11-28,4:23
Hey @Andreas Frederiksen, The streamslice function is designed to work with rectangular domains defined by the X and Y coordinate grids. When you have a non-rectangular domain, such as the parabolic domain created by transforming Y to Ynew, the function still operates within the bounding rectangle of the provided grid. Unfortunately, streamslice does not have built-in support for non-rectangular domains, but you can work around this limitation by using masking techniques to hide parts of the plot that fall outside your desired domain.
Here's how you can approach this problem:
1. Mask the Streamlines:
  • Plot the streamlines using streamslice.
  • Use masking to hide parts of the streamlines that fall outside your desired domain.
2. Custom Plotting:
  • Use stream2 to compute the streamlines manually and then selectively plot only those segments that lie within your desired domain.

类别

Help CenterFile Exchange 中查找有关 Volume Visualization 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by