davalillocm


SUBMITTED BY: davalillocm

DATE: May 12, 2022, 4:20 p.m.

UPDATED: May 13, 2022, 12:46 a.m.

FORMAT: Matlab

SIZE: 526 Bytes

HITS: 389

  1. function [V]=SMOOTHER(U,p)
  2. % Smooth by colum the matrix U, p times
  3. %
  4. %
  5. [m,n]=size(U);
  6. req=p*p+4;
  7. V=zeros(m,n);
  8. if m>req
  9. for q=1:p
  10. for j=1:n
  11. V(1,j)=U(1,j);
  12. V(2,j)=U(2,j);
  13. for i=3:(m-2)
  14. V(i,j)=(U(i-2,j)+U(i-1,j)+U(i,j)+U(i+1,j)+U(i+2,j))/5;
  15. end
  16. V(m-1,j)=U(m-1,j);
  17. V(m,j)=U(m,j);
  18. end
  19. U=V;
  20. end
  21. else
  22. error('myApp:argChk', ['More than ', num2str(req),' points needed!']);
  23. end
  24. end

comments powered by Disqus