reading velocity vectors from figure 1 at ly = 0.5 and lx = 0.5 and plotting the graph

14 views (last 30 days)
Hi everyone,
This code below creates figure 1,
if floor(25*k/nt)>floor(25*(k-1)/nt), fprintf('.'), end
if k==1|floor(nsteps*k/nt)>floor(nsteps*(k-1)/nt)
% stream function
rhs = reshape(diff(U')'/hy-diff(V)/hx,[],1);
q(perq) = Rq\(Rqt\rhs(perq));
Q = zeros(nx+1,ny+1);
Q(2:end-1,2:end-1) = reshape(q,nx-1,ny-1);
clf, contourf(avg(x),avg(y),P',20,'w-'), hold on
contour(x,y,Q',20,'k-');colormap;
Ue = [uS' avg([uW;U;uE]')' uN'];
Ve = [vW;avg([vS' V vN']);vE];
Len = sqrt(Ue.^2+Ve.^2+eps);
unode = (Ue./Len);
vnode = (Ve./Len);
quiver(x,y,unode',vnode',.4,'k-')
hold off, axis equal, axis([0 lx 0 ly])
p = sort(p); caxis(p([8 end-7]))
title(sprintf('Re = %0.1g t = %0.2g',Re,k*dt))
drawnow
end
end
Figure 1 can be found at,
http://imageshack.us/photo/my-images/830/figure1.jpg/ ____________________________________________________________
What i am trying to do now is to to plot a graph called figure 2 by taking the velocity values from figure 1 at, (lx=0.5) vertical center line (u-component) and the (ly=0.5) horizontal center line (v-component).
Figure 2 should look like, refer to the link below,
_____________________________________________________________
So can anyone guide me on how to achieve figure 2 ?
_____________________________________________________________
I tried creating figure 2 using the code below but it was incorrect.
for ly = 0.5
lyloc = find(abs(y - 0.5) < 100*eps(0.5), 1);
thisv = vnode(:, lyloc);
fid = fopen('ly=0.5.txt','w');
fprintf(fid,' %5.3f \n' ,thisv)
status = fclose(fid);
end
for lx = 0.5
lxloc = find(abs(x - 0.5) < 100*eps(0.5), 1);
thisu = unode(:, lxloc);
fid = fopen('lx=0.5.txt','w');
fprintf(fid,' %5.3f \n' ,thisu)
status = fclose(fid);
figure (2) , plot(thisu,thisv), axis([-1 1 -1 2])
end
  4 Comments
Walter Roberson
Walter Roberson on 19 Dec 2011
I was not able to see the vector field arrows in your figure 1. I do see black lines, but those look to be lines from the contour() call.
iceuday
iceuday on 19 Dec 2011
The velocity vector field arrows are there, it is hard to see them as they are small and the blue color makes it difficult to view it.
I have uploaded another link for figure 1, refer to the link below,
http://imageshack.us/photo/my-images/406/figure1withvisibleveloc.jpg/

Sign in to comment.

Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!