Direction of Arrows in Quiver (2D)
조회 수: 4 (최근 30일)
이전 댓글 표시
this is related to the question asked here:
so I did make to seperate quivers for the inwards and outwards arrows. the new problem is, that some of my arrows that i think should be pointing outwards are pointing inwards.
here is how i created this, tell me where you think i am wrong:
-
-
% find slope of profile
m_profile(2:45, :)=diff(z1)./diff(x1);
m_profile(1,:)=1.7612;
m_profile(29,:)=0;
-
-
%find arrow slope according to m2=-1/m1
m_arrow=-1./m_profile; theta=atand(m_arrow);
-
%create mark vector - indicating which arrows should point inweard(negative cp values)
for j=1:num
for i=1:45
if cp_norm(j,i)<0
mark(i,j)=1; %mark arrows pointing inwards
end end end
% sort flagged control points - create 2 matrixes - one for inwards(flag) and one for outward (nflag) arrows
k=1; l=1;
flag=[];
nflag=[];
for i=1:45
if mark(i,j)==1
flag(k,1)=x1(i,j);
flag(k,2)=z1(i,j);
flag(k,3)=cp_norm(j,i)*cosd(theta(i,j));
flag(k,4)=cp_norm(j,i)*sind(theta(i,j));
k=k+1;
else
nflag(l,1)=x1(i,j);
nflag(l,2)=z1(i,j);
nflag(l,3)=cp_norm(j,i)*cosd(theta(i,j));
nflag(l,4)=cp_norm(j,i)*sind(theta(i,j));
l=l+1;
end
end
still the result is some of the arrows are pointing inwards as you can see, where am i wrong?
thanks,
Noa
댓글 수: 0
채택된 답변
José-Luis
2012년 9월 20일
I'm gonna venture a wild guess. We don't know what your data looks like (well, except from the plot). However, this line:
m_profile(2:45, :)=diff(z1)./diff(x1);
would indicate that you are taking some sort of slope. However, you are only considering the forward difference. Maybe an average, the central difference, would give the results you want.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Vector Fields에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!