Can the isolines be made smoother?

1 回表示 (過去 30 日間)
Darya
Darya 2025 年 4 月 2 日
コメント済み: John D'Errico 2025 年 4 月 2 日
Can you make the isolines smoother? So that there are no sharp corners and such sharp transitions
  2 件のコメント
dpb
dpb 2025 年 4 月 2 日
Either generate the data on a finer mesh or if that isn't possible, you'll have to try to interpolate what you have...
John D'Errico
John D'Errico 2025 年 4 月 2 日
Think about it. You have a coarse mesh of data. Contour plotting uses LINEAR interpolation on that mesh. Anything else will be intractable, and if you did find a scheme that would work to generate smooth contours, then you would always find problems, artifacts due to the method used. And that means a linear interpolant is necessary.
So what do you see? You see STRAIGHT contour lines, that change slope at shapr corners. This is inescapable. You have two potential solutions:
  1. Generate data on a finer mesh. If the mesh is sufficiently fine, and your surface a smooth one, then the contour lines will themselves be smooth.
  2. Interpolate your data, again generating a finer mesh of the existing data. If your interpolant is itself a smooth one, then you will now get nice smooth looking contour lines. Note that if your interpolant does strange things, then you can get strange looking contours, so the result will be only as good as the effort you make at insuring your interpolation makes sense. (Remember there are infinitely many ways to interpolate any set of points, so the choice is yours.)

サインインしてコメントする。

回答 (1 件)

Torsten
Torsten 2025 年 4 月 2 日
移動済み: Torsten 2025 年 4 月 2 日
Use "scatteredInterpolant" and evaluate the resulting interpolation function F on a regular grid with a large number of points. Then apply "contourf".

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by