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

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Magnitude and direction of vectors

Asked by Ede gerlderlands on 30 Jun 2013

I have really find it difficult to plot both flow and direction of flow vectors superimposed each other. I have plotted the direction of the flow vector using

quiver(n,s,x,y) .

But the magnitude is given by

mag= sqrt(x.^2+y.^2);

Is there a way to plot magnitude of vector with direction

Thanks in advance.

0 Comments

Ede gerlderlands

Products

No products are associated with this question.

1 Answer

Answer by the cyclist on 30 Jun 2013
Edited by the cyclist on 30 Jun 2013

Really, I think you can solve your problem by reading the documentation for quiver() more carefully.

doc quiver

The first two arguments specify the spot where each vector will begin. The next two specify the length of each component.

x_start  = 1;
y_start  = 2;
x_length = 7;
y_length = 3;
figure
scale=0;
quiver(x_start,y_start,x_length,y_length,scale); % Set scale==0, to prevent auto-scaling. See documentation.

For your real plot, x_start etc are going to be column vectors with your actual data.

0 Comments

the cyclist

Contact us