From: Wilson on
Hello,
I am having trouble with my plot using quiver. For the vectors created by quiver, it starts at the coordinate indincated in quiver(x,y) and draw the vector toward the direction it should go. What if I want the coordinates to be the midpoint of the segment? so it has half of the line left of the coordinate given and half on the right. Is there a property I can change to achieve that?

Thank you,

Wilson
From: pipa on
I dont know about any inbuilt function that can do this....but u can simply translate the coordinate system to achieve this.




"Wilson " <wilson761022(a)yahoo.com.tw> wrote in message <hnduho$pu3$1(a)fred.mathworks.com>...
> Hello,
> I am having trouble with my plot using quiver. For the vectors created by quiver, it starts at the coordinate indincated in quiver(x,y) and draw the vector toward the direction it should go. What if I want the coordinates to be the midpoint of the segment? so it has half of the line left of the coordinate given and half on the right. Is there a property I can change to achieve that?
>
> Thank you,
>
> Wilson
From: Peter on
On Mar 12, 9:44 am, "Wilson " <wilson761...(a)yahoo.com.tw> wrote:
> Hello,
>       I am having trouble with my plot usingquiver. For the vectors created byquiver, it starts at the coordinate indincated inquiver(x,y) and draw the vector toward the direction it should go. What if I want the coordinates to be the midpoint of the segment? so it has half of the line left of the coordinate given and half on the right. Is there a property I can change to achieve that?
>
> Thank you,
>
> Wilson

Hi, Wilson.

I wrote myquiver.m to address this problem...


function myquiver(x,y,u,v)
%MYQUIVER Centered quiver plot
% Syntax: myquiver(x,y,u,v)
% Peter S. Simon
% 5/22/2008
h = quiver(x,y,u,v,'r-','MaxHeadSize', 0.4);
hold on
h1 = quiver(x,y,-u,-v,'r-');
set(h1,'showarrowhead','off')
set([h,h1], 'autoscalefactor',0.5)
return

Hope this helps,
--Peter