How to use curl for 2D-vector field correctly?

Hi everyone,
I've some data from a simulation like (x,y,u,v) which u corresponds to velocity in x-direction and v in y-direction. In order to compute the curl of vector V(u,v) i did it like so:
x = data(:,1);
y = data(:,2);
u = data(:,3);
v = data(:,4);
V = [u v];
R = [x y];
curl = curl(V,R);
Now i wanna to see if my code is correct or is there any mistake?
Many thanks!

댓글 수: 1

Andreas Passos
Andreas Passos 2021년 2월 25일
편집: Andreas Passos 2021년 2월 25일
I have the exact same question,
'how to calculate the curl of a trajectory'
if you found the answer please let me know

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

답변 (1개)

Jess Lovering
Jess Lovering 2019년 8월 15일

0 개 추천

I think you might have to make those inputs into matrix format first with meshgrid. Then you can pass those directly into curl.
x = data(:,1);
y = data(:,2);
u = data(:,3);
v = data(:,4);
[X,Y] = meshgrid(x,y);
[U,V] = meshgrid(u,v);
curl = curl(X,Y,U,V);

댓글 수: 2

Nima
Nima 2019년 8월 15일
If I use meshgrid, then I will receive 0 and NAN as results of curl!
Sorry - you are right. I am not sure because the help says it needs to be a matrix "as if produced by meshgrid."

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

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2019년 8월 15일

편집:

2021년 2월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by