clear all
d=30;N=d^2;
F2=fft(eye(d))/sqrt(d); %Small Fourier for creation of Zak
Z = zeros(N,N);
F=fft(eye(N))/d;
n = 0:d-1;
n=d*n;
for j = 0:d^2-1;
Z(j+1,n+1+floor(j/d)) = F2(mod(j,d)+1,:); %Zak transform
end;
jj=[1:N]; % creating two tone signal
kk=[floor(N/2):N];
f=sin(50*jj/pi);
f(kk)=sin(450*kk/pi);
Zf=Z'*f'; %taking inverse Zak to create spectrogram
ZF=zeros(d,d);
for k=1:d %turning the vector into
figure(1) %original signal a matrix
for m=1:d
ZF(k,m)=Zf((k-1)*d+m);
end;
end;
clf
plot(f);
figure(2) %Fourier transform
plot(abs(F*f'))
figure(3) % spectrogram-Inverse Zak
imagesc(abs(ZF))
p=audioplayer(f,1000)
play(p, [1 (get(p, 'SampleRate') )]);