Compute the curl of a trajectory (identify clockwise or anti-clockwise motion)
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi everyone,
I want to calculate the curl from single trajectories.
Basically, I want to identify if the trajectory rotates clockwise of anti-clock wise and measure the rotation speed.
I use something like the below:
x = data(:,1);
y = data(:,2);
u = data(:,3);
v = data(:,4);
V = [u v];
R = [x y];
curlRes = curl(V,R);
The result is 0 everywhere.
'Index in position 1 is invalid. Array indices must be positive integers or logical values.'
the vectors u,v contain negative values as they indicate the direction of the velocity
Thank you
댓글 수: 0
답변 (1개)
Tejas
2024년 5월 24일
Hello Andreas,
It looks like you are curious about why there is an issue when trying to use the curl function and how to correctly do it.
According to the documentation, the syntax used in the initial call to the curl function is not recognized, which likely led to receiving 0 as a result due to the misinterpretation of input data arguments.
The issue with the second call to the curl function might stem from x and y being single-dimensional arrays. For the curl function to work as intended, x and y should define a grid of points on the 2D plane, with u and v specifying the vector field components at each point on this grid.
Below is a simple example from the documentation illustrating the correct approach:
[x,y] = meshgrid(-4:4,-4:4);
Fx = -y*2;
Fy = x*2;
quiver(x,y,Fx,Fy)
[curlz,cav] = curl(x,y,Fx,Fy)
On successfully applying the curl function to the input data, the result's positive sign will denote anti-clockwise rotation, whereas a negative sign will indicate clockwise rotation.
For additional insights on the curl function, consult the following documentation:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Transmitters and Receivers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!