matlab - Interpolating produces weird results -
one easy question reason cannot see answer to:
i working on matlab project need interpolate specific set of data. have 2d-matrix mat , 2 vectors x , y assign value each column , row (strictly monotonically increasing of course). matrix 0s, except diagonal lines amongst has nonzero values.
i wish interpolate data along thise lines on entire area, linear interpolation should enough now. approach is
[y,x] = meshgrid(y,x); %create meshgrid out of grid vectors ysave=y;xsave=x; m = mat; %now, eliminate elements mat 0 since want interpolate there y(mat==0)=[]; x(mat==0)=[]; m(mat==0)=[]; interpolant = scatteredinterpolant(y',x',m'); % , create our interpolant result = interpolant(ysave,xsave);
however, when execute code, interpolated picture not not resemble "intuitive" interpolation @ - not have original data points included... doing wrong?
thanks help!
edit comments, visibility: imgur.com/a/7baxm visual respresentation of data. top picture interpolated result, bottom 1 input data. there no values close zero, , can tell, pictures far similar. looks bit correct interpolation got streched weirdly or something...
you have series of 1d interpolation problem -- interpolating intensity values s along lines. rotate data first align lines x-axis example, ask matlab 1d interpolate on scattered points (x_i, s_i)
Comments
Post a Comment