Can the isolines be made smoother?

6 Ansichten (letzte 30 Tage)
Darya
Darya am 2 Apr. 2025
Kommentiert: John D'Errico am 2 Apr. 2025
Can you make the isolines smoother? So that there are no sharp corners and such sharp transitions
  2 Kommentare
dpb
dpb am 2 Apr. 2025
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 am 2 Apr. 2025
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.)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Torsten
Torsten am 2 Apr. 2025
Verschoben: Torsten am 2 Apr. 2025
Use "scatteredInterpolant" and evaluate the resulting interpolation function F on a regular grid with a large number of points. Then apply "contourf".

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by