How to plot constant vector field: f(x,y)=2 ax + ay

16 views (last 30 days)
x=-3:3;
>> y=-5:5;
>> [x,y]=meshgrid(x,y);
>> u=2;v=1;
>> quiver(x,y,u,v)
Error using quiver (line 44)
The size of X must match the size of U or the number of columns of U.

Accepted Answer

VBBV
VBBV on 26 Mar 2022
Edited: VBBV on 26 Mar 2022
x=-3:3;
y=-5:5;
[x,y]=meshgrid(x,y);
u=repmat(2,length(x),7);
v=repmat(1,length(x),7);
quiver(x,y,u,v)
  1 Comment
VBBV
VBBV on 30 Mar 2022
Thanks is accepting answer, please accept answer if it solved your doubt, :)

Sign in to comment.

More Answers (0)

Categories

Find more on Vector Fields in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!