%% Generate a signal
t = 0:.001:5;            % 5 seconds sampled every 1 ms (1000 Hz sampling rate)
y = rand(size(t));       % random noise
figure;
subplot(2,1,1)
plot(t,y,'-'); xlabel('TIME (sec)'); ylabel('SIGNAL');

%% perform an FFT of the signal and plot the spectrum
[f, m, p] = fft_plus (y, 1000); % 1000 Hz sampling rate
m(1) = 0; % eliminate artifact at 0 Hz
subplot(2,1,2)
plot(f,m,'.-'); xlabel('Frequency (Hz)'); ylabel('Magnitude')

%% high-pass filter 150 Hz cutoff
y_f = PLGhighpass(y,1000,150);
[f_f, m_f, p_f] = fft_plus (y_f, 1000);
m_f(1) = 0; % eliminate 0 Hz artifact
figure;
subplot(2,1,1)
plot(t,y_f,'-'); xlabel('TIME (sec)'); ylabel('SIGNAL');
subplot(2,1,2)
plot(f_f,m_f,'.-'); xlabel('Frequency (Hz)'); ylabel('Magnitude')
