%%%%%%%%DTFS MATRIX%%%%%%%%%%
fvz=50;  
t=0:1/fvz:1; 
f=5;  
x=sin(2*pi*f*t);
figure(1);
stem(t,x);

 
vektorx=x';
X=vektorx(1:10,1);


N=10;
W=exp(-j*2*pi/N)
%%%%%%%%%%%%%%%%%%%%
for k=0:N-1
  for n=0:N-1
  
  T(k+1,n+1)=W^(n*k);
  end
end
%%%%%%%%%%%%%%%%
T;
DTFS=T*X;
rekonstrukcia=ifft(DTFS);
figure(2);
stem(0:1/50:9/50,rekonstrukcia);


%%%%%%%%%IFFT%%%%%%%%%%%%%%%%%



%%%%%%%%%%%%%%%%%%%%
for n=0:N-1
  for k=0:N-1
  
  TI(k+1,n+1)=W^-(n*k);
  end
end
%%%%%%%%%%%%%%%%

IFFTmarix=(1/N)*TI*DTFS;
rekonstrukcia=ifft(DTFS);

porovnanie=[abs(IFFTmarix) abs(rekonstrukcia)]