Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Questions about Quiver

Subject: Questions about Quiver

From: Wilson

Date: 12 Mar, 2010 17:44:24

Message: 1 of 3

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

Subject: Questions about Quiver

From: pipa

Date: 13 Mar, 2010 00:13:05

Message: 2 of 3

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




"Wilson " <wilson761022@yahoo.com.tw> wrote in message <hnduho$pu3$1@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

Subject: Questions about Quiver

From: Peter

Date: 13 Mar, 2010 06:20:31

Message: 3 of 3

On Mar 12, 9:44 am, "Wilson " <wilson761...@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

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us