how to graph vector fields containing scalar

2 ビュー (過去 30 日間)
수정 이
수정 이 2020 年 11 月 14 日
回答済み: Monisha Nalluru 2020 年 11 月 17 日
I'm trying to graph some vector fields .
F(x,y,z)-<1,2,z>
F(x,y)=<0.3, -0,4)
my code is look like this
>> [x,y,z]=meshgrid(-2:2,-2:2,-2:2);
>> u=1;
>> v=2;
>> s=z;
>> quiver(x,y,z,u,v,s)
Second one is similar.
>> [x,y,]=meshgrid(-2:2,-2:2);
>> u=0.3;
>> v=-0.4;
>> quiver(x,y, u,v )
I tried to use ones(size(v)) function but it doens't work.
Any help would be helpful. Thank you

回答 (1 件)

Monisha Nalluru
Monisha Nalluru 2020 年 11 月 17 日
quiver used to for vector plot
The input arguments X,Y,U,V all should be of same size
In the above problem u,v should be same size of x,y
As an example
[x,y,]=meshgrid(-2:2,-2:2);
u=ones(size(x));
v=ones(size(x)) * 2;
quiver(x,y,u,v)
And inorder to increase the arrow length use scale argument
quiver(x,y,u,v,2) % scale the arrow length to 2 units

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by