
function [S,T] = ISPECTREgen(Shat,Omega);
N = length(Shat)-1; Shat(1) = (Shat(1)+Shat(N+1))/2;  
u = ifft(Shat(1:N)');
k = 1:N; w = ((-1).^(k-1))'; 
u = w.*u; u1 = u(1:fix(N/2))'; u2 = u(fix(N/2)+1:N)';
S = 2*Omega*[u2 u1 0]; T = N/(4*Omega);  
end

