필터 지우기
필터 지우기

How to get rid of values from meshgrid

조회 수: 1 (최근 30일)
esat gulhan
esat gulhan 2020년 9월 21일
댓글: Ameer Hamza 2020년 9월 21일
My code is below. I want to get rid of middle values of mesgrid which are very large. Nan maybe.
Is there any way to get rid of midle values (ı do not want see values in the midle of meshgrid ı want to blank [1 1] square from midle of meshgrid)
syms u uo ur v x y Q C r T tt
V=100;b=2;uo=-V*sin(Q);ur=V*2*pi*b/(2.*pi.*r)+V*cos(Q);r=(x.^2+y.^2).^0.5;Q=atan2(y,x);
uo=subs(uo);ur=subs(ur);
%VECTORFIELD
[x,y] = meshgrid(-5:gl:5,-5:gl:5);
u=subs(ur*cos(Q)-uo*sin(Q));v=subs(ur*sin(Q)+uo*cos(Q));
quiver(x,y,u,v,1.01,'r','linewidth',2),grid on

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 9월 21일
편집: Ameer Hamza 2020년 9월 21일
Try this
syms u uo ur v x y Q C r T tt
V=100;b=2;uo=-V*sin(Q);ur=V*2*pi*b/(2.*pi.*r)+V*cos(Q);r=(x.^2+y.^2).^0.5;Q=atan2(y,x);
uo=subs(uo);ur=subs(ur);
%VECTORFIELD
gl = 0.11; % to avoid 0 in the meshgrid
[x,y] = meshgrid(-5:gl:5);
u=subs(ur*cos(Q)-uo*sin(Q));v=subs(ur*sin(Q)+uo*cos(Q));
mask = (abs(x) < 1) & (abs(y) < 1);
u(mask) = 0;
v(mask) = 0;
quiver(x,y,u,v,1.01,'r','linewidth',2),grid on
  댓글 수: 2
esat gulhan
esat gulhan 2020년 9월 21일
Yes, Exactly it is...
Ameer Hamza
Ameer Hamza 2020년 9월 21일
I am glad to be of help!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by