As the title of Damien's entry states, smoothn is a fast and easy smoothing function for n-dimensional data. It uses a generalized cross-validation method to estimate the smoothing parameter, which affects the quality of the output. In layman's terms, it automatically does things for you so that you just pass in the noisy data and out comes the smoothed data. Damian includes links to two of his papers for technical reference for those interested in the detailed theory.
From what I've seen, his code is very well written (Code Analyzer is green!), with plenty of error-checking and good use of vectorized code. It has extensive help, and he includes many different types of examples. Here is one that I liked.
Noisy image with missing data
Filling in missing data in an image?! What?!
n = 256; % Original image y0 = peaks(n); % Noisy image with missing data y = y0 + randn(size(y0))*2; I = randperm(n^2); y(I(1:n^2*0.5)) = NaN; % lose 1/2 of data y(40:90,140:190) = NaN; % create a hole % Smoothed image z = smoothn(y); % <-- That's all!! % View subplot(2,2,1:2) imshow(y,) title('Noisy corrupt data') subplot(2,2,3) imshow(z,) title('Recovered data ...') subplot(2,2,4) imshow(y0,) title('... compared with the actual data') colormap(parula)
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.