Exclude zero from domain.

23 ビュー (過去 30 日間)
Gurpreet Singh
Gurpreet Singh 2018 年 9 月 26 日
編集済み: dpb 2018 年 9 月 26 日
Hello, I am relatively new to Matlab and would like some help. I want to plot the following program however, I see that the graph is not defined at x = 0 and y = 0. After some research I attempted the
"x = x(x~=0); and y = y(y~=0);"
command, but this still leads me to an empty graph. Any help will be appreciated. Thank you.
x=-1:0.1:1;
y=-1:0.1:1;
x = x(x~=0);
y = y(y~=0);
dx=0.1;
[x,y]=meshgrid(-1:dx:1,-1:dx:1);
u = 1./(x.^2);
v = 1./(y.^2);
quiver(x,y,u,v);
axis equal

採用された回答

madhan ravi
madhan ravi 2018 年 9 月 26 日
編集済み: dpb 2018 年 9 月 26 日
x=-1:0.1:1;
y=-1:0.1:1;
x=nonzeros(x);
y=nonzeros(y)
%y = y(y~=0);
dx=0.1;
[X,Y]=meshgrid(x,y);
u = 1./(X.^2);
v = 1./(Y.^2);
quiver(X,Y,u,v);
axis equal

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by