Kink in contour of a 2D tensor when transformed from cartesian to polar coordinates

조회 수: 5 (최근 30일)
I have a 2D tensor field, in Cartesian coordinates (x an y) and can be expressed as a 2x2 matrix in the Cartesian basis. The tensor can be converted to polar coordinates using tensor transformation, where is the transformation matrix and θ can be found using
theta = cart2pol(x,y)
The transformation is carried out at each (x,y).
Now, one of the components of the transformed matrix is plotted at each (x,y):
contourf(x,y,Mpolar11)
However, I observe a kink in the contour plot close to the origin (circled in red). I am trying to figure out what is causing this and how to get rid of it. I know for sure that doesn't have a kink.
Any suggestions?

답변 (1개)

Anurag
Anurag 2023년 10월 23일
Hi Pinkesh,
I understand that you want to know the reasoning behind the kink in your graph after the transformation of your 2D tensor field. Refer to the below points for diagnosing the issue:
  • The kink could be related to the singularity at the origin in polar coordinates. When r (the distance from the origin) is very close to zero, some functions can behave unexpectedly. Ensure that you handle these cases properly in your code.
  • Check the resolution of your meshgrid. If your (x, y) values near the origin are not well-sampled, it can lead to artifacts in the contour plot. Try increasing the resolution near the origin to see if the kink improves.
  • Experiment with the settings of your contour plot, such as contour levels or colormap, as they can influence the appearance of kinks in the plot.
  • You can apply a smoothing filter to the data before plotting it.
  • If your data is not uniformly sampled, consider using interpolation methods to generate a smoother representation of the data, which can result in a more continuous contour plot.
Hope this helped.
Regards,
Anurag

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by