Smoothing data by x axis values rather than cells

조회 수: 1 (최근 30일)
Alex Hughes
Alex Hughes 2021년 3월 24일
답변: Mathieu NOE 2021년 3월 24일
I am trying to compare slope values from bathymetric profiles with different resolutions ranging from 30m to 85m. Therefore, I need to smooth the profiles to a common resolution (say 200 m). I attach an example of my data where c is depth (to smooth in m), d1 is distance (m) and the resolution is ~60 m. I can take 200/60 m to get a smoothing window in cells per 200 m then use smooth or filter. For example:
span=round(200/resolution);
smooth_bathy=smooth(c,span);
The problem is that the span or smoothing window has to be an integer so the smoothed resolution between profiles is still different i.e. 200/60 = 180 m and 200/35 =175 m.
Can anyone suggest a method to smooth the data to exacly 200 m (i.e. smooth by absoute values of the data in the x axis rather than cells?). Thanks.
  댓글 수: 3
Alex Hughes
Alex Hughes 2021년 3월 24일
Thanks for you reply Mathieu. The solution you provide does what I was after. I had a mental block. Indeed all I needed to do was resmample rather than smooth. If you paste your solution in the answers section I'll happily accept it.
Mathieu NOE
Mathieu NOE 2021년 3월 24일
will do

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

채택된 답변

Mathieu NOE
Mathieu NOE 2021년 3월 24일
hello
to resample all data to 200 m resolution (whatever your resolution is ), simply use interp1 :
new_d = min(d1):200:max(d1); % new distance vector with 200 m resolution
new_c = interp1(d1,c,new_d); % new depth vector (matched with new_d)

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by