Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Interpolation of a bed profile.

Asked by Andrew Buglass on 5 Feb 2013

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

0 Comments

Andrew Buglass

Products

No products are associated with this question.

1 Answer

Answer by Jan Simon on 5 Feb 2013
Edited by Jan Simon on 5 Feb 2013

You can set the 0 values to NaN:

x(x==0) = NaN;

and call FEX: inpaint_nans.

Perhaps this helps also: FEX: gridfit

3 Comments

Andrew Buglass on 5 Feb 2013

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.

Jan Simon on 5 Feb 2013

A guidance is more likely, when you explain "cannot get it to work" with any details.

Sean de Wolski on 5 Feb 2013

+1 for inpaint_nans

Jan Simon

Contact us