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