Mercurial > hg > ishara
view general/numerical/rot45.m @ 4:e44f49929e56
Adding reorganised general toolbox, now in several subdirectories.
author | samer |
---|---|
date | Sat, 12 Jan 2013 19:21:22 +0000 |
parents | |
children |
line wrap: on
line source
function B = rot45(A) % rot45 - rotate square array by 45 degrees % % rot45 :: [[N,N]] -> [[N,N]]. % % Array is SUBSAMPLED, so, you should pre-filter to avoid aliasing. % Result is padded with zeros in the corners. n = length(A); B = diag(A,0)'; pad = [0]; for k=2:2:n-1 B = [ pad diag(A,k)' pad; B; pad diag(A,-k)' pad]; pad = [pad 0]; end