view dsp/rot45.m @ 36:9e7be347b3a0

Renamed sequence classes to avoid clashes with seq methods; Fixed default slicing dimension while retaining behaviour of window.m; Updated use of sequences in dsp/synth.
author samer
date Thu, 24 Jan 2013 14:51:23 +0000
parents db7f4afd27c5
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