Contour plot using meshgrid

6 ビュー (過去 30 日間)
Iver Brekken
Iver Brekken 2021 年 12 月 14 日
回答済み: Walter Roberson 2021 年 12 月 14 日
[x,y] = meshgrid(-5:0.1:5,-5:0.1:5);
r = sqrt(x.^2+y.^2);
theta = atan(y/x);
gamma = 2;
B = 2;
u = 1;
psi = u.*r.*sin(theta)-B./r.*sin(theta)-gamma/(2*pi).*log(r);
contour(x,y,psi)
When i run this, the plot is not showing the psi-function. How can that be? What do I have to change?
I get the following warnings:
Line 3: Matrix is singular to working precision
Line 8: Contour is not rendered for non-finite Zdata

採用された回答

Walter Roberson
Walter Roberson 2021 年 12 月 14 日
[x,y] = meshgrid(-5:0.1:5,-5:0.1:5);
r = sqrt(x.^2+y.^2);
theta = atan2(y, x);
gamma = 2;
B = 2;
u = 1;
psi = u.*r.*sin(theta)-B./r.*sin(theta)-gamma/(2*pi).*log(r);
contour(x,y,psi)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGamma Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by