%"Wings" induced due to "windowed" observations
%your telescope is located on a satellite which is rotating at frequency fs
%you are oberving a periodic (sine wave) source with frequeny f0
%you can observe the source for half of the rotation period of the
%satellite

    clear
    n=8192;
    f0=1000;    %frequency of the source
    fs=20;      %frequence of the satellite (rotation)
    t=0:n-1;
    h=sin(2*pi*f0*t/n);
    H=fft(h);
    P=H.*conj(H);
    Pn=P/(n/2)^2;

    figure(1)
    plot(t,Pn)
    xlim([0 n/2])

    figure(2)
    w=0.5*(sign(sin(2*pi*fs*t/n))+1);
    plot(t,w)

    figure(3)
    hs=h.*w;
    H=fft(hs);
    P=H.*conj(H);
    Pn=P/(n/2)^2;
    plot(t,Pn)
    xlim([0,n/2])

    figure(4)
    plot(t,Pn)
    xlim([f0-100 f0+100])   %the extra features are beat frequencies