  Home  |  About Us  |  Link To Us  |  FAQ  |  Contact  Inpaint over missing data in N-D arrays 1.0

Date Added: July 09, 2013  |  Visits: 314 Report Broken Link Printer Friendly Version Product Homepage Download (26 downloads)

Y = INPAINTN(X) replaces the missing data in X by extra/interpolating the non-missing elements. The non finite values (NaN or Inf) in X are considered as missing data. X can be any N-D array. Important note:----------------INPAINTN uses an iterative process that converges toward the solution. Y = INPAINTN(X,N) uses N iterations. By default, N = 100. If you estimate that INPAINTN did not totally converge, then increase N: Y = INPAINTN(X,1000);Notes:-----INPAINT_NANS and INPAINT_NANS3 are faster than INPAINTN when the number of NaN elements is (relatively) small. However, because INPAINT_NANS and INPAINT_NANS3 both involve huge matrices, they can be limited with large datasets. Example:--------%% ---- 3-D data ---- %%load windxmin = min(x(:)); xmax = max(x(:));zmin = min(z(:)); ymax = max(y(:));%-- wind velocityvel0 = interp3(sqrt(u.^2+v.^2+w.^2),1,'cubic');x = interp3(x,1); y = interp3(y,1); z = interp3(z,1);%-- remove randomly 90% of the dataI = randperm(numel(vel0));velNaN = vel0;velNaN(I(1:round(numel(I)*.9))) = NaN;%-- inpaint using INPAINTNvel = inpaintn(velNaN);%-- display the resultssubplot(221), imagesc(velNaN(:,:,15)), axis equal offtitle('Corrupt plane, z = 15')subplot(222), imagesc(vel(:,:,15)), axis equal offtitle('Reconstructed plane, z = 15')subplot(223)hsurfaces = slice(x,y,z,vel0,[xmin,100,xmax],ymax,zmin);set(hsurfaces,'FaceColor','interp','EdgeColor','none')hcont = contourslice(x,y,z,vel0,[xmin,100,xmax],ymax,zmin);set(hcont,'EdgeColor',[.7,.7,.7],'LineWidth',.5)view(3), daspect([2,2,1]), axis tighttitle('Original data compared with...')subplot(224)hsurfaces = slice(x,y,z,vel,[xmin,100,xmax],ymax,zmin);set(hsurfaces,'FaceColor','interp','EdgeColor','none')hcont = contourslice(x,y,z,vel,[xmin,100,xmax],ymax,zmin);set(hcont,'EdgeColor',[.7,.7,.7],'LineWidth',.5)view(3), daspect([2,2,1]), axis tighttitle('... reconstructed data')

 Requirements: No special requirements Platforms: Matlab Keyword: Display,  Equal,  Imagescvelnan,  Inpaint,  Inpaintnvelnan,  Results,  Subplot,  Velnan,  Velnani Roundnumeli Users rating: 0/10        