필터 지우기
필터 지우기

Tracing the Trajectory of a Circle of radius R around the line plot of position

조회 수: 4 (최근 30일)
William
William 2023년 7월 14일
댓글: Dyuman Joshi 2023년 8월 2일
I am working on some plots between interacting micro-swimmers in a 2D fluid which are modelled as circles. I have my code to output the positions of the swimmers as they swim and interact. However, because they have a radius R I want to trace the path of the whole circle as it moves to check that the spheres don't collide as my model doesn't account for this.
Below I have an example of a plot of two interacting swimmers that deflect each other due to their flow/turbulance as they progress through the fluid. I would like each line to be exactly of thickness 1 (i.e Radius = 0.5). Changing the line thickness directly on the plot doesn't work as it does not scale with the magnification/axes scale. What would be good is keeping the original line but with a slightly transparent or lighter colour trace of a circle of radius R moving along this line.
Hope this makes sense,
Cheers
  댓글 수: 1
Dyuman Joshi
Dyuman Joshi 2023년 7월 15일
You can draw a parallel lines to the original curve, one above the curve and one below the curve, with a specified distance.

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

답변 (1개)

Shushant
Shushant 2023년 8월 2일
Hi William,
I understand that while plotting a line you want it to be of certain thickness, which is not affected by the change in scale. To achieve this you can use "polyshape".
For example, Plotting a line from (-5,0) to (0,60) with thickness 1.
pgon = polyshape([-5 -5 0 0], [0.5 -0.5 59.5 60.5]);
plot(pgon)
Refer to the following documentation for more information -
I hope this helped in solving the issue you were facing.
Thank you,
Shushant
  댓글 수: 1
Dyuman Joshi
Dyuman Joshi 2023년 8월 2일
That would be rather difficult and/or messy for curves with bends, which is what OP is working with.

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

카테고리

Help CenterFile Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by