subplot(1,2,1)
title('Time Domain')
subplot(1,2,2)
title('Frequency Domain')
figure(gcf)
pause

% make up example star lumination with planet transit data
t = linspace(0,2*pi,20);
xdip = cos(t)/2 - 1/2;  % here's the slight dip
x = [zeros(1,100) xdip zeros(1,100)];
x = x+100; % dip plus a huge baseline level of star illumination
subplot(1,2,1)
stem(x)
title('daily perfect data of light from star with 220 day cycle')
xlabel('what happens when many years of data are collected?')
pause

for i=1:7 % let's collect 2^7 periods of data
    x = [x x];
end
stem(x)
title('daily perfect data of light from star over 100 years')
xlabel('stem too hard to read b/c too many samples; use plot')
pause

plot(x,'linewidth',2)
ylim([-10 110])
title('daily perfect data of light from star over100 years')
xlabel('what does the magnitude of its DFT look like?')
pause

X = fft(x);
subplot(1,2,2)
stem(abs(X))
title('|X[k]|')
xlabel('Looks like an impulse.  Zoom in 1000x vertically to check.')
pause

ylim([0 3200])
xlabel('zoom in horizontally 30x')
pause

xlim([0 1000])
xlabel('what is the k of the first harmonic?')
pause

xlim([0 180])
xlabel('k ~ 130.  k/N=f/fs so f=1/220, Ts=220 transits every 220 days')
pause

xlabel('How does noise affect this?')
pause

xn = x + randn(size(x));
subplot(1,2,1)
plot(xn)
ylim([-10 110])
title('noisy data of star light')
xlabel('what does the magnitude of its DFT look like?')
pause

Xn = fft(xn);
subplot(1,2,2)
stem(abs(Xn))
title('|Xn[k]|')
xlabel('Looks like an impulse.  Zoom in vert x1000 to check.')
pause

ylim([0 3200])
xlabel('zoom in horizontally 30x')
pause

xlim([0 180])
xlabel('k=128 in the noise.  k/N=f/fs so f=1/220, Ts=220, transits every 220 days')