📄 the tfarma toolbox v1_0 tutorial.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0067)http://www.nt.tuwien.ac.at/fileadmin/users/mjachan/TFARMATut10.html -->
<HTML><HEAD><TITLE>The TFARMA Toolbox v1.0 Tutorial</TITLE>
<META http-equiv=content-type content="text/html; charset=ISO-8859-1">
<META content="Michael Jachan" name=author>
<META content="MSHTML 6.00.3790.218" name=GENERATOR></HEAD>
<BODY>
<H1>The TFARMA Toolbox v1.0 Tutorial<BR></H1>
<H2>1. Introduction</H2>
<H3>1.1 Purpose</H3>
<P>Time-frequency autoregressive moving-average (TFARMA) models are a
parsimonious class of parametric models for nonstationary underspread processes.
Here we briefly describe how to use the <SPAN style="FONT-WEIGHT: bold">TFARMA
Toolbox v1.0</SPAN> for MATLAB(R) (tested with MATLAB v6.5.0 on SuSE Linux).
<SPAN style="FONT-FAMILY: monospace"></SPAN>The programming style is
educational! This tutorial <SPAN style="FONT-WEIGHT: bold">does not introduce
you to the TFARMA theory</SPAN> at all, which is to be found in the paper
</P><SPAN style="FONT-FAMILY: monospace"></SPAN><PRE>@conference{<A href="http://www.nt.tuwien.ac.at/fileadmin/users/mjachan/MJ-icassp03.pdf">MJ-icassp03</A>,<BR> author = {M. Jachan and G. Matz and F. Hlawatsch},<BR> title = {Time-Frequency-Autore\-gressive Random Processes: Modeling and Fast Parameter Estimation},<BR> booktitle = ICASSP03,<BR> volume = {VI},<BR> pages = {125--128},<BR> year = {2003},<BR> month = apr,<BR> address = {Hong Kong}<BR>}<BR></PRE>
<P>For the moment, only a TFAR identification function (<BIG><BIG><SPAN
style="FONT-FAMILY: monospace">help tfar</SPAN></BIG></BIG>) is available. </P>
<P><SPAN style="FONT-WEIGHT: bold"></SPAN><SPAN
style="FONT-WEIGHT: bold"></SPAN></P>
<P><SPAN style="FONT-WEIGHT: bold"></SPAN></P><SPAN
style="FONT-WEIGHT: bold"></SPAN>
<H3>1.2 Download and Installation<BR></H3>
<P>Download the MATLAB-functions and scripts as <A
href="http://www.nt.tuwien.ac.at/fileadmin/users/mjachan/TFARMA10.tgz"><BIG><BIG><SPAN
style="FONT-FAMILY: monospace">tgz</SPAN></BIG></BIG></A> (or <A
href="http://www.nt.tuwien.ac.at/fileadmin/users/mjachan/TFARMA10.zip"><BIG><BIG><SPAN
style="FONT-FAMILY: monospace">zip</SPAN></BIG></BIG></A>) version and untar
(<SPAN style="FONT-WEIGHT: bold"></SPAN><BIG><BIG><SPAN
style="FONT-FAMILY: monospace">tar -xvvzf TFARMA.tgz</SPAN></BIG></BIG>) them
into a chosen toolbox directory and set the MATLAB-path. [Further information
will be given in <BIG><BIG><SPAN
style="FONT-FAMILY: monospace">readme.txt</SPAN></BIG></BIG> of future versions.
] </P>
<P><SPAN style="FONT-WEIGHT: bold"></SPAN><SPAN
style="FONT-WEIGHT: bold"></SPAN></P><SPAN
style="FONT-WEIGHT: bold"></SPAN><SPAN style="FONT-WEIGHT: bold"></SPAN>
<H2>2. Quickstart: TFAR Identifcation and Modeling<BR></H2>
<H3>2.1 TFAR Identification in MATLAB<SPAN
style="FONT-WEIGHT: bold"></SPAN></H3>
<P>We are given a real or complex-valued nonstationary signal <SPAN
style="FONT-STYLE: italic">x</SPAN>[<SPAN style="FONT-STYLE: italic">n</SPAN>],
<SPAN style="FONT-STYLE: italic">n= 0, ..., N-</SPAN>1, with <SPAN
style="FONT-WEIGHT: bold; FONT-STYLE: italic">N</SPAN><SPAN
style="FONT-WEIGHT: bold"> a power of 2</SPAN>, which is stored in the
vector <BIG><BIG><SPAN
style="FONT-FAMILY: monospace">x</SPAN></BIG></BIG><SPAN
style="FONT-FAMILY: monospace"> </SPAN>(<BIG><BIG><SPAN
style="FONT-FAMILY: monospace">size(x)== [N, 1]</SPAN></BIG></BIG>). The signal
preferably exhibits spectral peaks, but not too deep spectral notches.
Otherwise, a TFARMA model would be more appropriate (see below). <SPAN
style="FONT-WEIGHT: bold">Anyway, if this is your first reading, you should
continue to fit a TFAR model, it is the simplest one!</SPAN> We assume that
<SPAN style="FONT-STYLE: italic">x</SPAN>[<SPAN
style="FONT-STYLE: italic">n</SPAN>] is generated by a TFAR(<SPAN
style="FONT-STYLE: italic">M</SPAN>, <SPAN style="FONT-STYLE: italic">L</SPAN>)
model with block length <SPAN style="FONT-STYLE: italic">N</SPAN> and unknown
parameters (<SPAN style="FONT-STYLE: italic">a</SPAN><SMALL><SPAN
style="FONT-STYLE: italic">m, l</SPAN></SMALL> for <SPAN
style="FONT-STYLE: italic">m</SPAN>= 0, ..., <SPAN
style="FONT-STYLE: italic">M</SPAN> and <SPAN
style="FONT-STYLE: italic">b</SPAN><SMALL><SPAN style="FONT-STYLE: italic">m,
l</SPAN></SMALL> for <SPAN style="FONT-STYLE: italic">m</SPAN>= 0) and order
(<SPAN style="FONT-STYLE: italic">M, L</SPAN>), they are to be estimated. The
signal could look like (upper: real part; lower: imaginary part) </P><PRE><SPAN style="FONT-FAMILY: monospace"></SPAN><SPAN style="FONT-FAMILY: monospace">figure(1);clf<BR>subplot(2, 1, 1);plot(real(x), 'Color', 'k', 'Linewidth', 2);axis([1 N -1.5 1.5])<BR>set(gca, 'XTick', [1 N/4 N/2 3*N/4 N])<BR>set(gca, 'XTickLabel', [0 N/4-1 N/2-1 3*N/4-1 N-1])<BR>set(gca, 'YTick', [ -1 1])<BR>subplot(2, 1, 2);plot(imag(x)</SPAN><SPAN style="FONT-FAMILY: monospace">, 'Color', 'k', 'Linewidth', 2</SPAN><SPAN style="FONT-FAMILY: monospace">);axis([1 N -1.5 1.5])<BR>set(gca, 'XTick', [1 N/4 N/2 3*N/4 N])<BR>set(gca, 'XTickLabel', [0 N/4-1 N/2-1 3*N/4-1 N-1])<BR>set(gca, 'YTick', [ -1 1])<BR><BR></SPAN></PRE><SPAN
style="FONT-FAMILY: monospace"></SPAN><IMG style="WIDTH: 75%; HEIGHT: 50%"
alt="The signal" src="The TFARMA Toolbox v1_0 Tutorial_files/signal.jpg"><BR>
<P><SPAN style="FONT-WEIGHT: bold">The TFAR identification function
(</SPAN><BIG style="FONT-WEIGHT: bold"><BIG><SPAN
style="FONT-FAMILY: monospace">help tfar</SPAN></BIG></BIG><SPAN
style="FONT-WEIGHT: bold">)</SPAN><SPAN
style="FONT-WEIGHT: bold; FONT-FAMILY: monospace"> </SPAN><SPAN
style="FONT-WEIGHT: bold">in its simplest form is called as</SPAN>
(<BIG><BIG><SPAN style="FONT-FAMILY: monospace">AmlEst</SPAN></BIG></BIG> and
<BIG><BIG><SPAN style="FONT-FAMILY: monospace">B0lEst</SPAN></BIG></BIG> are the
estimated model parameters)<BR></P><PRE style="FONT-WEIGHT: bold"><BIG><BIG><SPAN style="FONT-FAMILY: monospace">[AmlEst, B0lEst]= tfar(x); </SPAN></BIG></BIG></PRE>
<P>We <SPAN style="FONT-WEIGHT: bold">obtain a stabilized TFAR(</SPAN><SPAN
style="FONT-WEIGHT: bold; FONT-STYLE: italic">M, L</SPAN><SPAN
style="FONT-WEIGHT: bold">) model</SPAN> (<BIG><BIG><SPAN
style="FONT-FAMILY: monospace">AmlEst</SPAN><SMALL><SMALL>,
</SMALL></SMALL><SPAN style="FONT-FAMILY: monospace">B0lEst</SPAN></BIG></BIG>)
fitted to the given nonstationary data <SPAN
style="FONT-STYLE: italic">x</SPAN>[<SPAN style="FONT-STYLE: italic">n</SPAN>]
by use of the TF-Yule-Walker equations (an approximative least-squares
estimator) and the <A
href="http://www.nt.tuwien.ac.at/fileadmin/users/mjachan/MJ-icassp05.pdf">AIC</A>
order estimation criterion. The maximum model order (<SPAN
style="FONT-STYLE: italic">M</SPAN><SMALL>max</SMALL>, <SPAN
style="FONT-STYLE: italic">L</SPAN><SMALL>max</SMALL>) is limited by the
underspread condition <SPAN style="FONT-STYLE: italic">ML/N</SPAN><1/16
(i.e., <BIG><BIG><SPAN style="FONT-FAMILY: monospace">MMAX== min(8,
floor(N/16))</SPAN></BIG></BIG>, <BIG><BIG><SPAN
style="FONT-FAMILY: monospace">LMAX== min(4, floor(N/16))</SPAN></BIG></BIG>).
The estimated model order (<SPAN style="FONT-STYLE: italic">M, L</SPAN>) can be
displayed by <BR></P>
<P><SPAN style="FONT-FAMILY: monospace"></SPAN></P><PRE><SPAN style="FONT-FAMILY: monospace">[MEst, LEst]= param_dim(</SPAN><SPAN style="FONT-FAMILY: monospace">AmlEst</SPAN><SPAN style="FONT-FAMILY: monospace">)<BR></SPAN></PRE>
<P><SPAN style="FONT-FAMILY: monospace"></SPAN>The estimated parameters <BIG
style="FONT-FAMILY: monospace"><BIG>AmlEst</BIG></BIG>, <BIG
style="FONT-FAMILY: monospace"><BIG>B0lEst</BIG></BIG> can e.g. be used to
compute the estimated evolutionary TFAR spectrum of <SPAN
style="FONT-STYLE: italic">x</SPAN>[<SPAN style="FONT-STYLE: italic">n</SPAN>]
(<BIG><BIG><SPAN style="FONT-FAMILY: monospace">help </SPAN><SPAN
style="FONT-FAMILY: monospace">tfarma_evsp</SPAN><SPAN
style="FONT-FAMILY: monospace"></SPAN></BIG></BIG>) </P><PRE><SPAN style="FONT-FAMILY: monospace">PxEst= tfarma_evsp(Aml</SPAN><SPAN style="FONT-FAMILY: monospace">Est</SPAN><SPAN style="FONT-FAMILY: monospace">, B0l</SPAN><SPAN style="FONT-FAMILY: monospace">Est</SPAN><SPAN style="FONT-FAMILY: monospace">, N); <BR></SPAN></PRE>
<P>it may look like (<SPAN style="FONT-WEIGHT: bold"></SPAN>it is plotted
rotated such that time <SPAN style="FONT-STYLE: italic">n</SPAN> is on the
abscissa) <BR></P>
<P></P><PRE><SPAN style="FONT-FAMILY: monospace"></SPAN><SPAN style="FONT-FAMILY: monospace"></SPAN><SPAN style="FONT-FAMILY: monospace">figure(2);clf;imagesc(rot90(log(PxEst)));</SPAN><SPAN style="FONT-FAMILY: monospace">colormap(flipud(gray));<BR></SPAN><SPAN style="FONT-FAMILY: monospace">set(gca, 'XTick', [1 N/4 N/2 3*N/4 N])<BR>set(gca, 'XTickLabel', [0 N/4-1 N/2-1 3*N/4-1 N-1])<BR>set(gca, 'YTick', [1 N/4 N/2 3*N/4 N])<BR>set(gca, 'YTickLabel', [N/2-1 N/4-1 0 -N/4 -N/2])<BR></SPAN><BR></PRE><SPAN
style="FONT-FAMILY: monospace"></SPAN><SPAN
style="FONT-FAMILY: monospace"></SPAN><IMG style="WIDTH: 75%; HEIGHT: 50%"
alt="Estimated evolutionary TFAR spectrum"
src="The TFARMA Toolbox v1_0 Tutorial_files/estspec.jpg"><BR>
<P>Note that the <SPAN style="FONT-STYLE: italic">N</SPAN>x<SPAN
style="FONT-STYLE: italic">N</SPAN> matrix <BIG><BIG><SPAN
style="FONT-FAMILY: monospace">PxEst</SPAN></BIG></BIG> has as row index the
absolute time <SPAN style="FONT-STYLE: italic">n</SPAN> (from 0 to <SPAN
style="FONT-STYLE: italic">N</SPAN>-1) and column index the absolute frequency
<SPAN style="FONT-STYLE: italic">k</SPAN> (from -<SPAN
style="FONT-STYLE: italic">N</SPAN>/2 to <SPAN
style="FONT-STYLE: italic">N</SPAN>/2-1). <SPAN style="FONT-WEIGHT: bold">This
is a parametric time-varying power spectrum estimated from a single process
observation! We did not apply any TF-kernel smoothing techniques! </SPAN>Let us
compare the TFAR evolutionary spectrum with a nonparametric TF method. The
standard Rihaczek distribution (a special case of the generalized Wigner-Ville
distribution) without any TF-windowing of <SPAN
style="FONT-STYLE: italic">x</SPAN>[<SPAN style="FONT-STYLE: italic">n</SPAN>]
looks very distorted due to cross terms. To be fair, we apply a Gaussian-type
multiwindow taper to the Rihaczek distribution. Note that the parameters
"<BIG><BIG><SPAN style="FONT-FAMILY: monospace">16</SPAN></BIG></BIG>"
<BIG><BIG><SPAN style="FONT-FAMILY: monospace"></SPAN></BIG></BIG>(they are
effective duration resp. bandwidth of the taper-spreading function) have to be
designed by the user! <BR></P><PRE><SPAN style="FONT-FAMILY: monospace">Psi= tf_multiwin(N, 16, 16);<BR>WxEst= real(ml_to_nk( ambi_est(x, x, -1).*conj(Psi) ));<BR>figure(3);clf;imagesc(rot90(log(WxEst)));</SPAN><SPAN style="FONT-FAMILY: monospace">colormap(flipud(gray));<BR></SPAN><SPAN style="FONT-FAMILY: monospace">set(gca, 'XTick', [1 N/4 N/2 3*N/4 N])<BR>set(gca, 'XTickLabel', [0 N/4-1 N/2-1 3*N/4-1 N-1])<BR>set(gca, 'YTick', [1 N/4 N/2 3*N/4 N])<BR>set(gca, 'YTickLabel', [N/2-1 N/4-1 0 -N/4 -N/2])<BR></SPAN><BR></PRE><IMG
style="WIDTH: 75%; HEIGHT: 50%" alt="Estimated evolutionary TFAR spectrum"
src="The TFARMA Toolbox v1_0 Tutorial_files/winriha.jpg">
<P>Now we can compare <BIG><BIG><SPAN
style="FONT-FAMILY: monospace">figure(2)</SPAN></BIG></BIG>, which is described
by a the (<SPAN style="FONT-STYLE: italic">M</SPAN>+1)(2<SPAN
style="FONT-STYLE: italic">L</SPAN>+1) TFAR parameters and <BIG><BIG><SPAN
style="FONT-FAMILY: monospace">figure(3)</SPAN></BIG></BIG>, which is described
by <SPAN style="FONT-STYLE: italic">N</SPAN>^2 samples. What have we reached up
to now? <SPAN style="FONT-WEIGHT: bold">We estimated the evolutionary TFAR
spectrum of the given data </SPAN><SPAN
style="FONT-WEIGHT: bold; FONT-STYLE: italic">x</SPAN><SPAN
style="FONT-WEIGHT: bold">[</SPAN><SPAN
style="FONT-WEIGHT: bold; FONT-STYLE: italic">n</SPAN><SPAN
style="FONT-WEIGHT: bold">] by fitting a TFAR(</SPAN><SPAN
style="FONT-WEIGHT: bold; FONT-STYLE: italic">M, L</SPAN><SPAN
style="FONT-WEIGHT: bold">) model</SPAN>, which is described by a small amount
of TFAR parameters (<SPAN style="FONT-STYLE: italic">a</SPAN><SMALL><SPAN
style="FONT-STYLE: italic">m, l</SPAN></SMALL><SPAN style="FONT-STYLE: italic">,
b</SPAN><SMALL>0<SPAN style="FONT-STYLE: italic">, l</SPAN></SMALL>)! No
smoothing kernel design (which is absolutely necessary for nonparametric TF
methods) is needed. Furthermore, <SPAN style="FONT-WEIGHT: bold">a hand full of
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -