clear all;
close all;
clc;
%% Script of resampling of the real signals representing alpha and beta activity 
%% and plotting of spectrograms estimated of real signals
%
%% Description 
%
% Firstly, real signals are resampled to have the same sampling frequency
% as the estimated signals from Jansen's models. Secondly, spectrograms are
% estimated of these real signals and results are shown in figures.
%
%% Loading and resampling of the real signal representing alpha activity
%
[hdr, record] = edfread('S001R02.edf');
y = resample(record(11,:),500,160);
%
%% Loading and resampling of the real signal representing beta activity
%
[hdr2, record2] = edfread('S001R01.edf');
y2 = resample(record2(11,:),500,160);
%
%% Estimation and plottinf of spectrograms of these real signals
%
figure
subplot(211)
specgram(y(1:1762),512,500,kaiser(500,5),475)
title('Spectrogram of real signal - alpha activity')
xlabel('Time [s]')
ylabel('Frequency [Hz]')
hold on
subplot(212)
specgram(y2(1:1762),512,500,kaiser(500,5),475)
title('Spectrogram of real signal - beta activity')
xlabel('Time [s]')
ylabel('Frequency [Hz]')
hold off