How can I fit a smooth curve to an arbitrary shape?
조회 수: 6 (최근 30일)
이전 댓글 표시
I'm trying to simulate an airplane trajectory in 2D space and I need to smooth out some jagged corners that appear when I connect waypoints using ginput. The regular curve fitting tools don't seem to work since I'm not working with a one to one function. The x and y coordinates are parameterized with respect to time.
Is there any way that I can use matlab to automatically fit a smooth curve to the entire trajectory and return the coordinates of the new smoothed trajectory?
Any advice on this matter would be greatly appreciated.
댓글 수: 0
답변 (1개)
Walter Roberson
2011년 4월 11일
One approach to try would be to use a sliding window and replace each point by the centroid of the point and its nearest neighbours. Probably better, though, would be to weight by the distance to the other points -- for example if you do have a sharp corner at a distance from other points, you don't want it moved drastically.
Another approach would be to take the outline and smooth that. And I would suspect that some kind of erosion would work as well.
Another approach to consider is using a "snap to grid" processing of the ginput() values. Or see snapping afterwards, here
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!