% Script spgr_demo1.m, DMH

% Load data and set channel ID
load 20130321-all AD03 AD05 AD11 AD15 
dat=[AD03 AD05 AD11 AD15];
chan_names=[{'AD03'},{'AD05'},{'AD11'},{'AD15'}];

% Sampling rate
rate=1000;

%[spgr,cl] = spgr1a_mt1(dat,samp_rate,seg_pwr,seg_inc_fac,opt_str);
seg_pwr=10;
seg_inc_fac=1;
opt_str='M3';  % Option for Multi-taper smoothing - intermediate smoothing
% opt_str='M5';  % Option for Multi-taper smoothing - lot of smoothings
[spgr1,cl1] = spgr1a_mt1(dat(:,1),rate,seg_pwr,seg_inc_fac,opt_str);
[spgr2,cl2] = spgr1a_mt1(dat(:,2),rate,seg_pwr,seg_inc_fac,opt_str);
[spgr3,cl3] = spgr1a_mt1(dat(:,3),rate,seg_pwr,seg_inc_fac,opt_str);
[spgr4,cl4] = spgr1a_mt1(dat(:,4),rate,seg_pwr,seg_inc_fac,opt_str);
cl1.what=chan_names{1};
cl2.what=chan_names{2};
cl3.what=chan_names{3};
cl4.what=chan_names{4};


% Frequency range for plotting
frange=[0 100];
figure
subplot(4,1,1)
pspspgr1_sc(spgr1,cl1,frange)
subplot(4,1,2)
pspspgr1_sc(spgr2,cl2,frange)
subplot(4,1,3)
pspspgr1_sc(spgr3,cl3,frange)
subplot(4,1,4)
pspspgr1_sc(spgr4,cl4,frange)

% landscape_fig
