Interpolation of a bed profile.

Hello,
I have a series of "radials" around a pier giving the depth of a bed and I wish to plot. However, before doing so would like to interpolate the 0 values in between the radials. Any suggestions how to accomplish would be much appreciated?
if true
23 0 0 34 0 0 26 0 0 29
0 22 0 21 0 0 24 0 31 0
0 0 20 22 0 0 22 23 0 0
0 0 0 -400 -400 -400 -400 0 0 0
24 26 25 -400 -400 -400 -400 24 25 29
0 0 0 -400 -400 -400 -400 0 0 0
0 0 25 28 0 0 31 26 0 0
0 26 0 29 0 0 24 0 27 0
27 0 0 30 0 0 27 0 0 29
end
This is small piece of one set of data there are much more zero values on the original and there are 16 different sets of data. So manually calculated is not viable.
Thanks in Advance.
Andy

Answers (1)

Jan
Jan on 5 Feb 2013
Edited: Jan on 5 Feb 2013
You can set the 0 values to NaN:
x(x==0) = NaN;
Perhaps this helps also: FEX: gridfit

3 Comments

I've had a go at using the inpaint_nans file but cannot get it to work. Any chance of a bit of guidance please.
A guidance is more likely, when you explain "cannot get it to work" with any details.
+1 for inpaint_nans

Sign in to comment.

Asked:

on 5 Feb 2013

Community Treasure Hunt

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

Start Hunting!