clear all
close all

% generate data example
dt = 0.02
duration = 1.0
n = duration / dt

f1 = 4.0
f2 = 15.0
t = linspace(0,duration-dt,n);
x1 = sin(2*pi*f1*t);
x2 = sin(2*pi*f2*t);
x=x1+x2

figure(1)
subplot(2,1,1)
plot(t,x,'r-*')
xlabel('time')
ylabel('x1,x2')

subplot(2,1,2)
% compute FT
ft=fft(x);
freq = linspace(0,24,25);
plot(freq,abs(ft(1:25)),'-*')
xlabel('frequency')
ylabel('amplitude power')

