clear all;

%% Load data

fs = 100;
load x.mat;

%% Make AO
a = ao(tsdata(x(1:10000),fs));
a = set(a, 'name', 'a');

%% Make lpsd

win = specwin('Kaiser', 10, 150);

[f,r,m,L,rr,rrr] = ltpda_compute_f(fs, length(x), 100, 1, 200, win.rov/100);

pl = plist();
pl = append(pl, param('Kdes', 100));
pl = append(pl, param('Kmin', 2));
pl = append(pl, param('Jdes', fs*2));
pl = append(pl, param('Win', win));
pl = append(pl, param('Order', 1));
pl = append(pl, param('DEBUG', 'DEBUG'));

axx = ltpda_lpsd(a, pl);

%% Make pwelch

pl = plist();
pl = append(pl, param('Nfft', fs*2));
pl = append(pl, param('Win', win));

wxx = ltpda_pwelch(a, pl);

%%

figure
iplot(axx)
hold on
h = iplot(wxx);
set(h, 'Color', 'b', 'LineStyle', '--')

