Direction of Arrows in Quiver (2D)

4 Ansichten (letzte 30 Tage)
noa
noa am 20 Sep. 2012
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

Akzeptierte Antwort

José-Luis
José-Luis am 20 Sep. 2012
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.

Weitere Antworten (0)

Kategorien

Mehr zu Vector Fields finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by