I want to plot!!!

3 Ansichten (letzte 30 Tage)
혜승 주
혜승 주 am 17 Mai 2020
Kommentiert: 혜승 주 am 18 Mai 2020
[x,y]=meshgrid(-20:0.1:20);
m=2;
U=2;
a=4;
psi = U*y - (m/(2*pi))*(atan(y/(x-a))-atan(y/(x+a)));
contour(x,y,psi);
but I can't get my graphs. They are all blank page.

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 17 Mai 2020
Bearbeitet: Ameer Hamza am 17 Mai 2020
You need to use element-wise division: https://www.mathworks.com/help/matlab/ref/rdivide.html
[x,y]=meshgrid(-20:0.1:20);
m=2;
U=2;
a=4;
psi = U*y - (m/(2*pi))*(atan(y./(x-a))-atan(y./(x+a)));
%^ dot here and ^ here
contour(x,y,psi);
  1 Kommentar
혜승 주
혜승 주 am 18 Mai 2020
This really helped!! Thanks a lot!! 8ㅁ8

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

dpb
dpb am 17 Mai 2020
You left out some very key information MATLAB told you about...
...
contour(x,y,psi);
Warning: Matrix is singular to working precision.
Warning: Matrix is singular to working precision.
Warning: Contour not rendered for non-finite ZData
>> In contour (line 51)
That's a very big klew you didn't do something right!!!
And, what that is, is that you used the ordinary '*' and '/' operators in defining psi when you wanted and needed the dot operators for element-by-element operations. Use
psi = U*y - (m/(2*pi)).*(atan(y./(x-a))-atan(y./(x+a)));
instead and joy will ensue...
  1 Kommentar
혜승 주
혜승 주 am 18 Mai 2020
I should carefully read those! Thank you!!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by