필터 지우기
필터 지우기

How do I smooth a plot ?

조회 수: 1 (최근 30일)
Nimrod Daniel
Nimrod Daniel 2014년 7월 8일
댓글: Nimrod Daniel 2014년 7월 9일
Assuming I get a flying route graph like the attached one. Now I want the insect to fly in a smooth way - finite turning radius and finite accelerations. In other words, I want the 90 degrees turn into a vertical search to look like a curve, what's the best way to do it ?
Of course that I can lose some of the data points and replace them with others, or even add some new points in order to get a smooth curves, rather than an abrupt 90 degrees turns.

채택된 답변

Jos (10584)
Jos (10584) 2014년 7월 9일
If you have the signal processing toolbox FILTFILT, otherwise FILTER
x = [2 4 6 8 10 10 10 10 10 10 10 10 10 10 ] ;
y = [5 5 5 5 5 5 7 9 11 13 15 17 19 21 ] ;
n = 4 ; % smoothing window
b = ones(1,n) ;
xf = filtfilt(b,n,x) ;
yf = filtfilt(b,n,y) ;
plot(x,y,'bo',xf,yf,'r.-') ;
  댓글 수: 1
Nimrod Daniel
Nimrod Daniel 2014년 7월 9일
Thanks, your code works nicely, I'll check it out.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Jos (10584)
Jos (10584) 2014년 7월 8일
You want to apply 2D (3D?) smoothing filters, which is quite easy if you have the signal processing toolbox. You can also search the File Exchange for suggestions.

Nimrod Daniel
Nimrod Daniel 2014년 7월 8일
Yeah, 2D graph. Can you be more specific? which tool is the easiest to use ?

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by