Plotting streamlines in matlab.

11 ビュー (過去 30 日間)
Naveen K S
Naveen K S 2019 年 4 月 24 日
コメント済み: darova 2019 年 4 月 24 日
I am trying plot streamlines using the streamlinefunction. The number of streamlines i'm getting streamlines are way too less. I am attaching the code and the data file containing the velocity components and their co-ordinates. please help me in resolving the issue.

採用された回答

darova
darova 2019 年 4 月 24 日
Just increased number of starting points
img1.png img2.png
n = 100; % number of streamlines
starting_x = zeros(1,n); % starting points for streamlines
starting_y = linspace(-0.1,0.1,n);
  3 件のコメント
Naveen K S
Naveen K S 2019 年 4 月 24 日
After your suggestion i have edited the code as below. But I'm getting streamlines like in the attached file
mag_V = sqrt( velcomppos.Vx.^2 + velcomppos.Vy.^2);
% Filtering out zero velocity walls.
index = mag_V > 0.01;
xx = velcomppos.x(index);
yy = velcomppos.y(index);
Vxx = velcomppos.Vx(index);
Vyy = velcomppos.Vy(index);
FVx = scatteredInterpolant(xx,yy,Vxx,'linear','none');
FVy = scatteredInterpolant(xx,yy,Vyy,'linear','none');
%FVz = scatteredInterpolant(xx,yy,zz,Vzz,'linear','none');
% This is a very ugly grid for your problem but it works.
% A cylindrical grid would probably be more resource efficient
elements = 78; % how many subdivisions per dimensions.
% Mind you, this is 3D. Total memory gets large fast
[X3, Y3] = meshgrid(linspace(min(velcomppos.x),max(velcomppos.x),elements),...
linspace(min(velcomppos.y),max(velcomppos.y),elements));
%linspace(min(velcomppos.z),max(velcomppos.z),elements));
V3x = FVx(X3,Y3);
V3y = FVy(X3,Y3);
%V3z = FVz(X3,Y3);
mag_V3 = sqrt(V3x.^2 + V3y.^2); % velocity vector magnitude
n=100;
starting_x = zeros(1,n); % starting points for streamlines
starting_y = linspace(-0.1,0.1,n);
%[starting_y] = meshgrid(linspace(-0.007,.007,7));
(linspace(-0.1,.1,n));
figure(1)
clf
%plot(velcomppos.x,velcomppos.y,'.k','MarkerSize',1);
hold on
%quiver(velcomppos.x,velcomppos.y,velcomppos.Vx,velcomppos.Vy);
%h = slice(X3,Y3,mag_V3,[],0,-0.02:.02:0);
%set(h,'EdgeColor','w','FaceAlpha',0.75');
streamline(X3,Y3,V3x,V3y,starting_x,starting_y);
%set(h,'color','r','LineWidth',4);
axis ([ 0.170 0.35 -0.1 0.07])
grid on
hold on
xlabel('x');
ylabel('y');
set(get(gca,'YLabel'),'Rotation',0);
darova
darova 2019 年 4 月 24 日
Delete first row of your data (it's defective)
and change axis boundaries
axis ([ xmin xmax ymin ymax])

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeVector Fields についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by