I want to plot!!!

조회 수: 3 (최근 30일)
혜승 주
혜승 주 2020년 5월 17일
댓글: 혜승 주 2020년 5월 18일
[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.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 17일
편집: Ameer Hamza 2020년 5월 17일
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
혜승 주
혜승 주 2020년 5월 18일
This really helped!! Thanks a lot!! 8ㅁ8

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

dpb
dpb 2020년 5월 17일
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
혜승 주
혜승 주 2020년 5월 18일
I should carefully read those! Thank you!!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by