Rank: 1457 based on 43 downloads (last 30 days) and 1 file submitted
photo

Greg Reeves

E-mail
Lat/Long
34.138844, -118.12699

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by Greg
Updated   File Tags Downloads
(last 30 days)
Comments Rating
13 Mar 2009 Screenshot smooth2a Smooths a 2D matrix using a mean filter over a user-defined rectangle. Ignores and preserves NaNs. Author: Greg Reeves 2d, approximation, interpolation, mathematics, matrix, smooth 43 8
  • 5.0
5.0 | 6 ratings
Comments and Ratings by Greg
Updated File Comments Rating
12 Mar 2009 smooth2 Smooths the data in a 2D matrix with a user-defined resolution. Author: Kelly Hilands

I took out the for loops and just used array algebra to do essentially the same thing. Improved speed ~10 fold. I didn't bother checking whether edge behavior is the same. My edge behavior is similar to the default behavior in Matlab's builtin smooth function.

%Initial error statements and definitions
if nargin<2, error('Not enough input arguments!'), end

N(1) = Nr;
if nargin<3
    N(2) = N(1);
else
    N(2) = Nc;
end

if length(N(1))~=1, error('Nr must be a scalar!'), end
if length(N(2))~=1, error('Nc must be a scalar!'), end

[row,col] = size(matrixIn);
eL = spdiags(ones(row,2*N(1)+1),(-N(1):N(1)),row,row);
eL = eL./(repmat(sum(eL,1),row,1));
eR = spdiags(ones(col,2*N(2)+1),(-N(2):N(2)),col,col);
eR = eR./(repmat(sum(eR,2),1,col));

matrixOut = eL*matrixIn*eR;

Comments and Ratings on Greg's Files View all
Updated File Comment by Comments Rating
24 Jan 2011 smooth2a Smooths a 2D matrix using a mean filter over a user-defined rectangle. Ignores and preserves NaNs. Author: Greg Reeves PsiCom, JEC

I get this error trying to run the code on a 2-D matrix of type double:

"MTIMES is not supported for one sparse input and one single input."

What does this mean?

02 Jan 2011 smooth2a Smooths a 2D matrix using a mean filter over a user-defined rectangle. Ignores and preserves NaNs. Author: Greg Reeves Toljic, Nikola

Thanks.

07 Dec 2010 smooth2a Smooths a 2D matrix using a mean filter over a user-defined rectangle. Ignores and preserves NaNs. Author: Greg Reeves Novak, Mark

Thank you... this is perfectly implemented.

23 Aug 2010 smooth2a Smooths a 2D matrix using a mean filter over a user-defined rectangle. Ignores and preserves NaNs. Author: Greg Reeves Jakob

I experienced vertical and horizontal jumps when using the smooth2 procedure and spent quite a while tracking down something better when I stumbled across the list of work the smooth2 had inspired (yours being one of them). smooth2a completely resolved the issue. I thank you for this!

17 Aug 2010 smooth2a Smooths a 2D matrix using a mean filter over a user-defined rectangle. Ignores and preserves NaNs. Author: Greg Reeves Gan, Wuxing

very useful, I specially like its way to handle the NaN points.
thanks.

Top Tags Applied by Greg
2d, approximation, interpolation, mathematics, matrix
Files Tagged by Greg
Updated   File Tags Downloads
(last 30 days)
Comments Rating
13 Mar 2009 Screenshot smooth2a Smooths a 2D matrix using a mean filter over a user-defined rectangle. Ignores and preserves NaNs. Author: Greg Reeves 2d, approximation, interpolation, mathematics, matrix, smooth 43 8
  • 5.0
5.0 | 6 ratings

Contact us at files@mathworks.com