필터 지우기
필터 지우기

Why am I only getting partial streamlines.

조회 수: 6 (최근 30일)
Boris Chan
Boris Chan 2021년 2월 17일
댓글: David Goodmanson 2021년 2월 17일
I am trying to plot streamlines to look like this
But I am only getting part way
I have tried changing my sy and sx multiple times but it just changes what part shows up. I have no idea what I'm doing wrong
Here's my code
%%
[X,Y] = meshgrid(-5:0.5:5);
sx = linspace(-5,5,20);
sy = sx;
% sx = (-5:0.5:5);
% sy = ones(size(sx));
sy = sx./sx;
% [SX,SY] = meshgrid(sx,sy);
%let U = e1 & V = e2
U = Y;
V = X;
figure()
hold on
quiver(X,Y,U,V);
streamline(X,Y,U,V,sx,sy,[0.1,20000]);

채택된 답변

David Goodmanson
David Goodmanson 2021년 2월 17일
Hi Boris,
the problem is the line sy = sx./sx which creates a vector of ones for sy. Then every streamline originates at the horizontal line sy =1. Here is an example that draws the streamlines orginating from the left side (upper half) and the top side (left half); the remining two sides are similar.
[X,Y] = meshgrid(-5:0.5:5);
sx = linspace(0,5,10);
sx(end) =[]; % eliminate streamlines originating at the corners
sy = sx;
onx = ones(size(sx));
ony = ones(size(sy));
U = Y;
V = X;
figure()
hold on
quiver(X,Y,U,V);
streamline(X,Y,U,V,-5*onx,sy,[0.1,20000]);
streamline(X,Y,U,V,-sx, 5*ony,[0.1,20000]);
hold off
  댓글 수: 2
Boris Chan
Boris Chan 2021년 2월 17일
Oh I see so your answer gives half, so since I have 4 quadrants I have to repeat the streamline function 4x with different parameters?
David Goodmanson
David Goodmanson 2021년 2월 17일
yes, that's right.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by