function [f,freqrange] = spectrum_generic(u,n,lambda)
% function f = spectrum_generic(u) : power spectrum of u using ME.m etc.
%
% several parameters can be set here and different methods used by
% modifying this file accordingly

% >>> Burg's method
% >>> uncomment the following 2-lines
% ARorder=9; f=pburg(u,ARorder);
% startfreq=0; endfreq=pi; freqrange=linspace(startfreq,endfreq,length(f));
% A=[0 0;1 0]; b=[1;0];
% return

% >>> High resolution method: set N, LAMBDA, STARTFREQ and ENDFREQ for
%                             specifying a frequency range of interest
%n=5; lambda=0.5*exp(j*1.2);
startfreq=0; endfreq=pi;

freqrange=linspace(startfreq,endfreq,500);
[A,b]=rjordan2(n,lambda);

u=u(:)';
P=dlsim_real(A,b,u);
f = me(P,A,b,freqrange);