streamline line value v=atan(y/x) not giving me "Warning: Matrix is singular to working precision"
2 ビュー (過去 30 日間)
古いコメントを表示
>> [x,y]=meshgrid(0:0.1:5,0:0.1:5);
>> u=y;
>> v=atan(y/x);
Trying to do a streamline plot using the u and v listed above but I get the error "Warning: Matrix is singular to working precision." how am I able to plot it without that error?
0 件のコメント
採用された回答
Steven Lord
2023 年 3 月 16 日
I'd recommend using atan2 instead of dividing. If you had to divide, use element-wise division (the ./ operator) instead of matrix division (the / operator.)
[x,y]=meshgrid(0:0.1:5,0:0.1:5);
u=y;
v1 = atan2(y, x);
v2 = atan(y./x);
The elements of v1 and v2 match except where v2 contains a NaN value (where both x and y are equal to 0.)
[v1(1), v2(1)]
v2(1) = 0;
isequal(v1, v2)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Vector Fields についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!