How to use the streamline function for a circular area?

34 次查看(过去 30 天)
Hi all,
Let's say, 'x' and 'y' in the mat file are the coordinate of the circular area, consist of 64 ununiformly distributed points on radial lines and 180 uniformly distributed angles. 'ux' and 'uy' in the mat file are the velocity on x and y directions. But when I use 'streamline(x,y,ux,uy,0.1,0.1)' or 'stream2(x,y,ux,uy,0.1,0.1)' to plot the streamline of the circular area, it always gives me the error message
"Error using griddedInterpolant
Interpolation requires at least two sample points in each dimension."
So I would like to know how to use the streamline function for a circular area.
Thank all in advance, any advice would be much appreciated.

采纳的回答

darova
darova 2019-10-14
You can just make new grid/mesh for your data (standard rectangular, corners are NaN)
Here is a way:
clc,clear
load test.mat
[m,n] = size(x);
x1 = linspace( min(x(:)), max(x(:)), 50 ); % x boundary
y1 = linspace( min(y(:)), max(y(:)), 50 ); % y boundary
[X,Y] = meshgrid(x1,y1); % new mesh
U = griddata(x,y,Ux,X,Y); % new Ux
V = griddata(x,y,Uy,X,Y); % new Uy
t = linspace(0,2*pi,20);
[sx1,sy1] = pol2cart(t,5e-3); % start points
cla
streamline(X,Y,U,V, sx1, sy1)
hold on
plot(sx1,sy1,'*r') % start points of streamlines
plot(x(end,:),y(end,:),'.-r') % boundary of a region
hold off
axis equal

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Clutter 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by