File: Signal-Processing.html

package info (click to toggle)
octave 6.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 124,192 kB
  • sloc: cpp: 322,665; ansic: 68,088; fortran: 20,980; objc: 8,121; sh: 7,719; yacc: 4,266; lex: 4,123; perl: 1,530; java: 1,366; awk: 1,257; makefile: 424; xml: 147
file content (1046 lines) | stat: -rw-r--r-- 48,838 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Signal Processing (GNU Octave (version 6.2.0))</title>

<meta name="description" content="Signal Processing (GNU Octave (version 6.2.0))">
<meta name="keywords" content="Signal Processing (GNU Octave (version 6.2.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html" rel="up" title="Top">
<link href="Image-Processing.html" rel="next" title="Image Processing">
<link href="Vector-Rotation-Matrices.html" rel="prev" title="Vector Rotation Matrices">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<span id="Signal-Processing"></span><div class="header">
<p>
Next: <a href="Image-Processing.html" accesskey="n" rel="next">Image Processing</a>, Previous: <a href="Geometry.html" accesskey="p" rel="prev">Geometry</a>, Up: <a href="index.html" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Signal-Processing-1"></span><h2 class="chapter">31 Signal Processing</h2>

<p>This chapter describes the signal processing and fast Fourier
transform functions available in Octave.  Fast Fourier transforms are
computed with the <small>FFTW</small> or <small>FFTPACK</small> libraries depending on how
Octave is built.
</p>
<span id="XREFfft"></span><dl>
<dt id="index-fft">: <em></em> <strong>fft</strong> <em>(<var>x</var>)</em></dt>
<dt id="index-fft-1">: <em></em> <strong>fft</strong> <em>(<var>x</var>, <var>n</var>)</em></dt>
<dt id="index-fft-2">: <em></em> <strong>fft</strong> <em>(<var>x</var>, <var>n</var>, <var>dim</var>)</em></dt>
<dd><p>Compute the discrete Fourier transform of <var>x</var> using
a Fast Fourier Transform (FFT) algorithm.
</p>
<p>The FFT is calculated along the first non-singleton dimension of the
array.  Thus if <var>x</var> is a matrix, <code>fft (<var>x</var>)</code> computes the
FFT for each column of <var>x</var>.
</p>
<p>If called with two arguments, <var>n</var> is expected to be an integer
specifying the number of elements of <var>x</var> to use, or an empty
matrix to specify that its value should be ignored.  If <var>n</var> is
larger than the dimension along which the FFT is calculated, then
<var>x</var> is resized and padded with zeros.  Otherwise, if <var>n</var> is
smaller than the dimension along which the FFT is calculated, then
<var>x</var> is truncated.
</p>
<p>If called with three arguments, <var>dim</var> is an integer specifying the
dimension of the matrix along which the FFT is performed.
</p>
<p><strong>See also:</strong> <a href="#XREFifft">ifft</a>, <a href="#XREFfft2">fft2</a>, <a href="#XREFfftn">fftn</a>, <a href="#XREFfftw">fftw</a>.
</p></dd></dl>


<span id="XREFifft"></span><dl>
<dt id="index-ifft">: <em></em> <strong>ifft</strong> <em>(<var>x</var>)</em></dt>
<dt id="index-ifft-1">: <em></em> <strong>ifft</strong> <em>(<var>x</var>, <var>n</var>)</em></dt>
<dt id="index-ifft-2">: <em></em> <strong>ifft</strong> <em>(<var>x</var>, <var>n</var>, <var>dim</var>)</em></dt>
<dd><p>Compute the inverse discrete Fourier transform of <var>x</var>
using a Fast Fourier Transform (FFT) algorithm.
</p>
<p>The inverse FFT is calculated along the first non-singleton dimension
of the array.  Thus if <var>x</var> is a matrix, <code>fft (<var>x</var>)</code> computes
the inverse FFT for each column of <var>x</var>.
</p>
<p>If called with two arguments, <var>n</var> is expected to be an integer
specifying the number of elements of <var>x</var> to use, or an empty
matrix to specify that its value should be ignored.  If <var>n</var> is
larger than the dimension along which the inverse FFT is calculated, then
<var>x</var> is resized and padded with zeros.  Otherwise, if <var>n</var> is
smaller than the dimension along which the inverse FFT is calculated,
then <var>x</var> is truncated.
</p>
<p>If called with three arguments, <var>dim</var> is an integer specifying the
dimension of the matrix along which the inverse FFT is performed.
</p>
<p><strong>See also:</strong> <a href="#XREFfft">fft</a>, <a href="#XREFifft2">ifft2</a>, <a href="#XREFifftn">ifftn</a>, <a href="#XREFfftw">fftw</a>.
</p></dd></dl>


<span id="XREFfft2"></span><dl>
<dt id="index-fft2">: <em></em> <strong>fft2</strong> <em>(<var>A</var>)</em></dt>
<dt id="index-fft2-1">: <em></em> <strong>fft2</strong> <em>(<var>A</var>, <var>m</var>, <var>n</var>)</em></dt>
<dd><p>Compute the two-dimensional discrete Fourier transform of <var>A</var> using
a Fast Fourier Transform (FFT) algorithm.
</p>
<p>The optional arguments <var>m</var> and <var>n</var> may be used specify the number of
rows and columns of <var>A</var> to use.  If either of these is larger than the
size of <var>A</var>, <var>A</var> is resized and padded with zeros.
</p>
<p>If <var>A</var> is a multi-dimensional matrix, each two-dimensional sub-matrix
of <var>A</var> is treated separately.
</p>
<p><strong>See also:</strong> <a href="#XREFifft2">ifft2</a>, <a href="#XREFfft">fft</a>, <a href="#XREFfftn">fftn</a>, <a href="#XREFfftw">fftw</a>.
</p></dd></dl>


<span id="XREFifft2"></span><dl>
<dt id="index-ifft2">: <em></em> <strong>ifft2</strong> <em>(<var>A</var>)</em></dt>
<dt id="index-ifft2-1">: <em></em> <strong>ifft2</strong> <em>(<var>A</var>, <var>m</var>, <var>n</var>)</em></dt>
<dd><p>Compute the inverse two-dimensional discrete Fourier transform of <var>A</var>
using a Fast Fourier Transform (FFT) algorithm.
</p>
<p>The optional arguments <var>m</var> and <var>n</var> may be used specify the number of
rows and columns of <var>A</var> to use.  If either of these is larger than the
size of <var>A</var>, <var>A</var> is resized and padded with zeros.
</p>
<p>If <var>A</var> is a multi-dimensional matrix, each two-dimensional sub-matrix
of <var>A</var> is treated separately.
</p>
<p><strong>See also:</strong> <a href="#XREFfft2">fft2</a>, <a href="#XREFifft">ifft</a>, <a href="#XREFifftn">ifftn</a>, <a href="#XREFfftw">fftw</a>.
</p></dd></dl>


<span id="XREFfftn"></span><dl>
<dt id="index-fftn">: <em></em> <strong>fftn</strong> <em>(<var>A</var>)</em></dt>
<dt id="index-fftn-1">: <em></em> <strong>fftn</strong> <em>(<var>A</var>, <var>size</var>)</em></dt>
<dd><p>Compute the N-dimensional discrete Fourier transform of <var>A</var> using
a Fast Fourier Transform (FFT) algorithm.
</p>
<p>The optional vector argument <var>size</var> may be used specify the dimensions
of the array to be used.  If an element of <var>size</var> is smaller than the
corresponding dimension of <var>A</var>, then the dimension of <var>A</var> is
truncated prior to performing the FFT.  Otherwise, if an element of
<var>size</var> is larger than the corresponding dimension then <var>A</var> is
resized and padded with zeros.
</p>
<p><strong>See also:</strong> <a href="#XREFifftn">ifftn</a>, <a href="#XREFfft">fft</a>, <a href="#XREFfft2">fft2</a>, <a href="#XREFfftw">fftw</a>.
</p></dd></dl>


<span id="XREFifftn"></span><dl>
<dt id="index-ifftn">: <em></em> <strong>ifftn</strong> <em>(<var>A</var>)</em></dt>
<dt id="index-ifftn-1">: <em></em> <strong>ifftn</strong> <em>(<var>A</var>, <var>size</var>)</em></dt>
<dd><p>Compute the inverse N-dimensional discrete Fourier transform of <var>A</var>
using a Fast Fourier Transform (FFT) algorithm.
</p>
<p>The optional vector argument <var>size</var> may be used specify the dimensions
of the array to be used.  If an element of <var>size</var> is smaller than the
corresponding dimension of <var>A</var>, then the dimension of <var>A</var> is
truncated prior to performing the inverse FFT.  Otherwise, if an element of
<var>size</var> is larger than the corresponding dimension then <var>A</var> is
resized and padded with zeros.
</p>
<p><strong>See also:</strong> <a href="#XREFfftn">fftn</a>, <a href="#XREFifft">ifft</a>, <a href="#XREFifft2">ifft2</a>, <a href="#XREFfftw">fftw</a>.
</p></dd></dl>


<p>Octave uses the <small>FFTW</small> libraries to perform FFT computations.  When Octave
starts up and initializes the <small>FFTW</small> libraries, they read a system wide
file (on a Unix system, it is typically <samp>/etc/fftw/wisdom</samp>) that
contains information useful to speed up FFT computations.  This
information is called the <em>wisdom</em>.  The system-wide file allows
wisdom to be shared between all applications using the <small>FFTW</small> libraries.
</p>
<p>Use the <code>fftw</code> function to generate and save wisdom.  Using the
utilities provided together with the <small>FFTW</small> libraries
(<code>fftw-wisdom</code> on Unix systems), you can even add wisdom
generated by Octave to the system-wide wisdom file.
</p>
<span id="XREFfftw"></span><dl>
<dt id="index-fftw">: <em><var>method</var> =</em> <strong>fftw</strong> <em>(&quot;planner&quot;)</em></dt>
<dt id="index-fftw-1">: <em></em> <strong>fftw</strong> <em>(&quot;planner&quot;, <var>method</var>)</em></dt>
<dt id="index-fftw-2">: <em><var>wisdom</var> =</em> <strong>fftw</strong> <em>(&quot;dwisdom&quot;)</em></dt>
<dt id="index-fftw-3">: <em></em> <strong>fftw</strong> <em>(&quot;dwisdom&quot;, <var>wisdom</var>)</em></dt>
<dt id="index-fftw-4">: <em></em> <strong>fftw</strong> <em>(&quot;threads&quot;, <var>nthreads</var>)</em></dt>
<dt id="index-fftw-5">: <em><var>nthreads</var> =</em> <strong>fftw</strong> <em>(&quot;threads&quot;)</em></dt>
<dd>
<p>Manage <small>FFTW</small> wisdom data.
</p>
<p>Wisdom data can be used to significantly accelerate the calculation of the
FFTs, but implies an initial cost in its calculation.  When the <small>FFTW</small>
libraries are initialized, they read a system wide wisdom file (typically in
<samp>/etc/fftw/wisdom</samp>), allowing wisdom to be shared between applications
other than Octave.  Alternatively, the <code>fftw</code> function can be used to
import wisdom.  For example,
</p>
<div class="example">
<pre class="example"><var>wisdom</var> = fftw (&quot;dwisdom&quot;)
</pre></div>

<p>will save the existing wisdom used by Octave to the string <var>wisdom</var>.
This string can then be saved to a file and restored using the <code>save</code>
and <code>load</code> commands respectively.  This existing wisdom can be
re-imported as follows
</p>
<div class="example">
<pre class="example">fftw (&quot;dwisdom&quot;, <var>wisdom</var>)
</pre></div>

<p>If <var>wisdom</var> is an empty string, then the wisdom used is cleared.
</p>
<p>During the calculation of Fourier transforms further wisdom is generated.
The fashion in which this wisdom is generated is also controlled by
the <code>fftw</code> function.  There are five different manners in which the
wisdom can be treated:
</p>
<dl compact="compact">
<dt><code>&quot;estimate&quot;</code></dt>
<dd><p>Specifies that no run-time measurement of the optimal means of
calculating a particular is performed, and a simple heuristic is used
to pick a (probably sub-optimal) plan.  The advantage of this method is
that there is little or no overhead in the generation of the plan, which
is appropriate for a Fourier transform that will be calculated once.
</p>
</dd>
<dt><code>&quot;measure&quot;</code></dt>
<dd><p>In this case a range of algorithms to perform the transform is considered
and the best is selected based on their execution time.
</p>
</dd>
<dt><code>&quot;patient&quot;</code></dt>
<dd><p>Similar to <code>&quot;measure&quot;</code>, but a wider range of algorithms is
considered.
</p>
</dd>
<dt><code>&quot;exhaustive&quot;</code></dt>
<dd><p>Like <code>&quot;measure&quot;</code>, but all possible algorithms that may be used to
treat the transform are considered.
</p>
</dd>
<dt><code>&quot;hybrid&quot;</code></dt>
<dd><p>As run-time measurement of the algorithm can be expensive, this is a
compromise where <code>&quot;measure&quot;</code> is used for transforms up to the size
of 8192 and beyond that the <code>&quot;estimate&quot;</code> method is used.
</p></dd>
</dl>

<p>The default method is <code>&quot;estimate&quot;</code>.  The current method can
be queried with
</p>
<div class="example">
<pre class="example"><var>method</var> = fftw (&quot;planner&quot;)
</pre></div>

<p>or set by using
</p>
<div class="example">
<pre class="example">fftw (&quot;planner&quot;, <var>method</var>)
</pre></div>

<p>Note that calculated wisdom will be lost when restarting Octave.  However,
the wisdom data can be reloaded if it is saved to a file as described
above.  Saved wisdom files should not be used on different platforms since
they will not be efficient and the point of calculating the wisdom is lost.
</p>
<p>The number of threads used for computing the plans and executing the
transforms can be set with
</p>
<div class="example">
<pre class="example">fftw (&quot;threads&quot;, <var>NTHREADS</var>)
</pre></div>

<p>Note that octave must be compiled with multi-threaded <small>FFTW</small> support for
this feature.  The number of processors available to the current process is
used per default.
</p>

<p><strong>See also:</strong> <a href="#XREFfft">fft</a>, <a href="#XREFifft">ifft</a>, <a href="#XREFfft2">fft2</a>, <a href="#XREFifft2">ifft2</a>, <a href="#XREFfftn">fftn</a>, <a href="#XREFifftn">ifftn</a>.
</p></dd></dl>


<span id="XREFfftconv"></span><dl>
<dt id="index-fftconv">: <em></em> <strong>fftconv</strong> <em>(<var>x</var>, <var>y</var>)</em></dt>
<dt id="index-fftconv-1">: <em></em> <strong>fftconv</strong> <em>(<var>x</var>, <var>y</var>, <var>n</var>)</em></dt>
<dd><p>Convolve two vectors using the FFT for computation.
</p>
<p><code>c = fftconv (<var>x</var>, <var>y</var>)</code> returns a vector of length equal to
<code>length (<var>x</var>) + length (<var>y</var>) - 1</code>.  If <var>x</var> and <var>y</var>
are the coefficient vectors of two polynomials, the returned value is the
coefficient vector of the product polynomial.
</p>
<p>The computation uses the FFT by calling the function <code>fftfilt</code>.  If
the optional argument <var>n</var> is specified, an N-point FFT is used.
</p>
<p><strong>See also:</strong> <a href="Products-of-Polynomials.html#XREFdeconv">deconv</a>, <a href="Products-of-Polynomials.html#XREFconv">conv</a>, <a href="Products-of-Polynomials.html#XREFconv2">conv2</a>.
</p></dd></dl>


<span id="XREFfftfilt"></span><dl>
<dt id="index-fftfilt">: <em></em> <strong>fftfilt</strong> <em>(<var>b</var>, <var>x</var>)</em></dt>
<dt id="index-fftfilt-1">: <em></em> <strong>fftfilt</strong> <em>(<var>b</var>, <var>x</var>, <var>n</var>)</em></dt>
<dd><p>Filter <var>x</var> with the FIR filter <var>b</var> using the FFT.
</p>
<p>If <var>x</var> is a matrix, filter each column of the matrix.
</p>
<p>Given the optional third argument, <var>n</var>, <code>fftfilt</code> uses the
overlap-add method to filter <var>x</var> with <var>b</var> using an N-point FFT.
The FFT size must be an even power of 2 and must be greater than or equal to
the length of <var>b</var>.  If the specified <var>n</var> does not meet these
criteria, it is automatically adjusted to the nearest value that does.
</p>

<p><strong>See also:</strong> <a href="#XREFfilter">filter</a>, <a href="#XREFfilter2">filter2</a>.
</p></dd></dl>


<span id="XREFfilter"></span><dl>
<dt id="index-filter">: <em><var>y</var> =</em> <strong>filter</strong> <em>(<var>b</var>, <var>a</var>, <var>x</var>)</em></dt>
<dt id="index-filter-1">: <em>[<var>y</var>, <var>sf</var>] =</em> <strong>filter</strong> <em>(<var>b</var>, <var>a</var>, <var>x</var>, <var>si</var>)</em></dt>
<dt id="index-filter-2">: <em>[<var>y</var>, <var>sf</var>] =</em> <strong>filter</strong> <em>(<var>b</var>, <var>a</var>, <var>x</var>, [], <var>dim</var>)</em></dt>
<dt id="index-filter-3">: <em>[<var>y</var>, <var>sf</var>] =</em> <strong>filter</strong> <em>(<var>b</var>, <var>a</var>, <var>x</var>, <var>si</var>, <var>dim</var>)</em></dt>
<dd><p>Apply a 1-D digital filter to the data <var>x</var>.
</p>
<p><code>filter</code> returns the solution to the following linear, time-invariant
difference equation:
</p>
<div class="example">
<pre class="example"> N                   M
SUM a(k+1) y(n-k) = SUM b(k+1) x(n-k)    for 1&lt;=n&lt;=length(x)
k=0                 k=0
</pre></div>


<p>where
N=length(a)-1 and M=length(b)-1.
The result is calculated over the first non-singleton dimension of <var>x</var>
or over <var>dim</var> if supplied.
</p>
<p>An equivalent form of the equation is:
</p>
<div class="example">
<pre class="example">          N                   M
y(n) = - SUM c(k+1) y(n-k) + SUM d(k+1) x(n-k)  for 1&lt;=n&lt;=length(x)
         k=1                 k=0
</pre></div>


<p>where
 c = a/a(1) and d = b/a(1).
</p>
<p>If the fourth argument <var>si</var> is provided, it is taken as the
initial state of the system and the final state is returned as
<var>sf</var>.  The state vector is a column vector whose length is
equal to the length of the longest coefficient vector minus one.
If <var>si</var> is not supplied, the initial state vector is set to all
zeros.
</p>
<p>In terms of the Z Transform, <var>y</var> is the result of passing the
discrete-time signal <var>x</var> through a system characterized by the following
rational system function:
</p>
<div class="example">
<pre class="example">          M
         SUM d(k+1) z^(-k)
         k=0
H(z) = ---------------------
            N
       1 + SUM c(k+1) z^(-k)
           k=1
</pre></div>


<p><strong>See also:</strong> <a href="#XREFfilter2">filter2</a>, <a href="#XREFfftfilt">fftfilt</a>, <a href="#XREFfreqz">freqz</a>.
</p></dd></dl>


<span id="XREFfilter2"></span><dl>
<dt id="index-filter2">: <em><var>y</var> =</em> <strong>filter2</strong> <em>(<var>b</var>, <var>x</var>)</em></dt>
<dt id="index-filter2-1">: <em><var>y</var> =</em> <strong>filter2</strong> <em>(<var>b</var>, <var>x</var>, <var>shape</var>)</em></dt>
<dd><p>Apply the 2-D FIR filter <var>b</var> to <var>x</var>.
</p>
<p>If the argument <var>shape</var> is specified, return an array of the desired
shape.  Possible values are:
</p>
<dl compact="compact">
<dt><code>&quot;full&quot;</code></dt>
<dd><p>pad <var>x</var> with zeros on all sides before filtering.
</p>
</dd>
<dt><code>&quot;same&quot;</code></dt>
<dd><p>unpadded <var>x</var> (default)
</p>
</dd>
<dt><code>&quot;valid&quot;</code></dt>
<dd><p>trim <var>x</var> after filtering so edge effects are no included.
</p></dd>
</dl>

<p>Note this is just a variation on convolution, with the parameters reversed
and <var>b</var> rotated 180 degrees.
</p>
<p><strong>See also:</strong> <a href="Products-of-Polynomials.html#XREFconv2">conv2</a>.
</p></dd></dl>


<span id="XREFfreqz"></span><dl>
<dt id="index-freqz">: <em>[<var>h</var>, <var>w</var>] =</em> <strong>freqz</strong> <em>(<var>b</var>, <var>a</var>, <var>n</var>, &quot;whole&quot;)</em></dt>
<dt id="index-freqz-1">: <em>[<var>h</var>, <var>w</var>] =</em> <strong>freqz</strong> <em>(<var>b</var>)</em></dt>
<dt id="index-freqz-2">: <em>[<var>h</var>, <var>w</var>] =</em> <strong>freqz</strong> <em>(<var>b</var>, <var>a</var>)</em></dt>
<dt id="index-freqz-3">: <em>[<var>h</var>, <var>w</var>] =</em> <strong>freqz</strong> <em>(<var>b</var>, <var>a</var>, <var>n</var>)</em></dt>
<dt id="index-freqz-4">: <em><var>h</var> =</em> <strong>freqz</strong> <em>(<var>b</var>, <var>a</var>, <var>w</var>)</em></dt>
<dt id="index-freqz-5">: <em>[<var>h</var>, <var>w</var>] =</em> <strong>freqz</strong> <em>(&hellip;, <var>Fs</var>)</em></dt>
<dt id="index-freqz-6">: <em></em> <strong>freqz</strong> <em>(&hellip;)</em></dt>
<dd>
<p>Return the complex frequency response <var>h</var> of the rational IIR filter
whose numerator and denominator coefficients are <var>b</var> and <var>a</var>,
respectively.
</p>
<p>The response is evaluated at <var>n</var> angular frequencies between 0 and
2*pi.
</p>
<p>The output value <var>w</var> is a vector of the frequencies.
</p>
<p>If <var>a</var> is omitted, the denominator is assumed to be 1 (this
corresponds to a simple FIR filter).
</p>
<p>If <var>n</var> is omitted, a value of 512 is assumed.  For fastest computation,
<var>n</var> should factor into a small number of small primes.
</p>
<p>If the fourth argument, <code>&quot;whole&quot;</code>, is omitted the response is
evaluated at frequencies between 0 and
pi.
</p>
<p><code>freqz (<var>b</var>, <var>a</var>, <var>w</var>)</code>
</p>
<p>Evaluate the response at the specific frequencies in the vector <var>w</var>.
The values for <var>w</var> are measured in radians.
</p>
<p><code>[&hellip;] = freqz (&hellip;, <var>Fs</var>)</code>
</p>
<p>Return frequencies in Hz instead of radians assuming a sampling rate
<var>Fs</var>.  If you are evaluating the response at specific frequencies
<var>w</var>, those frequencies should be requested in Hz rather than radians.
</p>
<p><code>freqz (&hellip;)</code>
</p>
<p>Plot the magnitude and phase response of <var>h</var> rather than returning them.
</p>

<p><strong>See also:</strong> <a href="#XREFfreqz_005fplot">freqz_plot</a>.
</p></dd></dl>


<span id="XREFfreqz_005fplot"></span><dl>
<dt id="index-freqz_005fplot">: <em></em> <strong>freqz_plot</strong> <em>(<var>w</var>, <var>h</var>)</em></dt>
<dt id="index-freqz_005fplot-1">: <em></em> <strong>freqz_plot</strong> <em>(<var>w</var>, <var>h</var>, <var>freq_norm</var>)</em></dt>
<dd><p>Plot the magnitude and phase response of <var>h</var>.
</p>
<p>If the optional <var>freq_norm</var> argument is true, the frequency vector
<var>w</var> is in units of normalized radians.  If <var>freq_norm</var> is false, or
not given, then <var>w</var> is measured in Hertz.
</p>
<p><strong>See also:</strong> <a href="#XREFfreqz">freqz</a>.
</p></dd></dl>


<span id="XREFsinc"></span><dl>
<dt id="index-sinc">: <em></em> <strong>sinc</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the sinc function.
</p>
<p>Return
sin (pi*x) / (pi*x).
</p></dd></dl>


<span id="XREFunwrap"></span><dl>
<dt id="index-unwrap">: <em><var>b</var> =</em> <strong>unwrap</strong> <em>(<var>x</var>)</em></dt>
<dt id="index-unwrap-1">: <em><var>b</var> =</em> <strong>unwrap</strong> <em>(<var>x</var>, <var>tol</var>)</em></dt>
<dt id="index-unwrap-2">: <em><var>b</var> =</em> <strong>unwrap</strong> <em>(<var>x</var>, <var>tol</var>, <var>dim</var>)</em></dt>
<dd>
<p>Unwrap radian phases by adding or subtracting multiples of 2*pi as
appropriate to remove jumps greater than <var>tol</var>.
</p>
<p><var>tol</var> defaults to pi.
</p>
<p>Unwrap will work along the dimension <var>dim</var>.  If <var>dim</var>
is unspecified it defaults to the first non-singleton dimension.
</p></dd></dl>



<span id="XREFarch_005ffit"></span><dl>
<dt id="index-arch_005ffit">: <em>[<var>a</var>, <var>b</var>] =</em> <strong>arch_fit</strong> <em>(<var>y</var>, <var>x</var>, <var>p</var>, <var>iter</var>, <var>gamma</var>, <var>a0</var>, <var>b0</var>)</em></dt>
<dd><p>Fit an ARCH regression model to the time series <var>y</var> using the scoring
algorithm in Engle&rsquo;s original ARCH paper.
</p>
<p>The model is
</p>
<div class="example">
<pre class="example">y(t) = b(1) * x(t,1) + &hellip; + b(k) * x(t,k) + e(t),
h(t) = a(1) + a(2) * e(t-1)^2 + &hellip; + a(p+1) * e(t-p)^2
</pre></div>

<p>in which <em>e(t)</em> is <em>N(0, h(t))</em>, given a time-series vector
<var>y</var> up to time <em>t-1</em> and a matrix of (ordinary) regressors <var>x</var>
up to <em>t</em>.  The order of the regression of the residual variance is
specified by <var>p</var>.
</p>
<p>If invoked as <code>arch_fit (<var>y</var>, <var>k</var>, <var>p</var>)</code> with a positive
integer <var>k</var>, fit an ARCH(<var>k</var>, <var>p</var>) process, i.e., do the above
with the <em>t</em>-th row of <var>x</var> given by
</p>
<div class="example">
<pre class="example">[1, y(t-1), &hellip;, y(t-k)]
</pre></div>

<p>Optionally, one can specify the number of iterations <var>iter</var>, the
updating factor <var>gamma</var>, and initial values <em>a0</em> and <em>b0</em>
for the scoring algorithm.
</p></dd></dl>


<span id="XREFarch_005frnd"></span><dl>
<dt id="index-arch_005frnd">: <em></em> <strong>arch_rnd</strong> <em>(<var>a</var>, <var>b</var>, <var>t</var>)</em></dt>
<dd><p>Simulate an ARCH sequence of length <var>t</var> with AR coefficients <var>b</var> and
CH coefficients <var>a</var>.
</p>
<p>The result <em>y(t)</em> follows the model
</p>
<div class="example">
<pre class="example">y(t) = b(1) + b(2) * y(t-1) + &hellip; + b(lb) * y(t-lb+1) + e(t),
</pre></div>

<p>where <em>e(t)</em>, given <var>y</var> up to time <em>t-1</em>, is
<em>N(0, h(t))</em>, with
</p>
<div class="example">
<pre class="example">h(t) = a(1) + a(2) * e(t-1)^2 + &hellip; + a(la) * e(t-la+1)^2
</pre></div>
</dd></dl>


<span id="XREFarch_005ftest"></span><dl>
<dt id="index-arch_005ftest">: <em>[<var>pval</var>, <var>lm</var>] =</em> <strong>arch_test</strong> <em>(<var>y</var>, <var>x</var>, <var>p</var>)</em></dt>
<dd><p>For a linear regression model
</p>
<div class="example">
<pre class="example">y = x * b + e
</pre></div>

<p>perform a Lagrange Multiplier (LM) test of the null hypothesis of no
conditional heteroscedascity against the alternative of CH(<var>p</var>).
</p>
<p>I.e., the model is
</p>
<div class="example">
<pre class="example">y(t) = b(1) * x(t,1) + &hellip; + b(k) * x(t,k) + e(t),
</pre></div>

<p>given <var>y</var> up to <em>t-1</em> and <var>x</var> up to <em>t</em>,
<em>e</em>(t) is <em>N(0, h(t))</em> with
</p>
<div class="example">
<pre class="example">h(t) = v + a(1) * e(t-1)^2 + &hellip; + a(p) * e(t-p)^2,
</pre></div>

<p>and the null is <em>a(1)</em> == &hellip; == <em>a(p)</em> == 0.
</p>
<p>If the second argument is a scalar integer, <em>k</em>, perform the same
test in a linear autoregression model of order <em>k</em>, i.e., with
</p>
<div class="example">
<pre class="example">[1, y(t-1), &hellip;, y(t-<var>k</var>)]
</pre></div>

<p>as the <em>t</em>-th row of <var>x</var>.
</p>
<p>Under the null, LM approximately has a chisquare distribution with
<var>p</var> degrees of freedom and <var>pval</var> is the <em>p</em>-value (1
minus the CDF of this distribution at LM) of the test.
</p>
<p>If no output argument is given, the <em>p</em>-value is displayed.
</p></dd></dl>


<span id="XREFarma_005frnd"></span><dl>
<dt id="index-arma_005frnd">: <em></em> <strong>arma_rnd</strong> <em>(<var>a</var>, <var>b</var>, <var>v</var>, <var>t</var>, <var>n</var>)</em></dt>
<dd><p>Return a simulation of the ARMA model.
</p>
<p>The ARMA model is defined by
</p>
<div class="example">
<pre class="example">x(n) = a(1) * x(n-1) + &hellip; + a(k) * x(n-k)
     + e(n) + b(1) * e(n-1) + &hellip; + b(l) * e(n-l)
</pre></div>

<p>in which <var>k</var> is the length of vector <var>a</var>, <var>l</var> is the length of
vector <var>b</var> and <var>e</var> is Gaussian white noise with variance <var>v</var>.
The function returns a vector of length <var>t</var>.
</p>
<p>The optional parameter <var>n</var> gives the number of dummy <var>x</var>(<var>i</var>)
used for initialization, i.e., a sequence of length <var>t</var>+<var>n</var> is
generated and <var>x</var>(<var>n</var>+1:<var>t</var>+<var>n</var>) is returned.  If <var>n</var>
is omitted, <var>n</var> = 100 is used.
</p></dd></dl>


<span id="XREFautoreg_005fmatrix"></span><dl>
<dt id="index-autoreg_005fmatrix">: <em></em> <strong>autoreg_matrix</strong> <em>(<var>y</var>, <var>k</var>)</em></dt>
<dd><p>Given a time series (vector) <var>y</var>, return a matrix with ones in the first
column and the first <var>k</var> lagged values of <var>y</var> in the other columns.
</p>
<p>In other words, for <var>t</var> &gt; <var>k</var>,
<code>[1, <var>y</var>(<var>t</var>-1), &hellip;, <var>y</var>(<var>t</var>-<var>k</var>)]</code> is the
t-th row of the result.
</p>
<p>The resulting matrix may be used as a regressor matrix in autoregressions.
</p></dd></dl>


<span id="XREFbartlett"></span><dl>
<dt id="index-bartlett">: <em></em> <strong>bartlett</strong> <em>(<var>m</var>)</em></dt>
<dd><p>Return the filter coefficients of a Bartlett (triangular) window of length
<var>m</var>.
</p>
<p>For a definition of the Bartlett window see, e.g.,
A.V. Oppenheim &amp; R. W. Schafer,
<cite>Discrete-Time Signal Processing</cite>.
</p></dd></dl>


<span id="XREFblackman"></span><dl>
<dt id="index-blackman">: <em></em> <strong>blackman</strong> <em>(<var>m</var>)</em></dt>
<dt id="index-blackman-1">: <em></em> <strong>blackman</strong> <em>(<var>m</var>, &quot;periodic&quot;)</em></dt>
<dt id="index-blackman-2">: <em></em> <strong>blackman</strong> <em>(<var>m</var>, &quot;symmetric&quot;)</em></dt>
<dd><p>Return the filter coefficients of a Blackman window of length
<var>m</var>.
</p>
<p>If the optional argument <code>&quot;periodic&quot;</code> is given, the periodic form
of the window is returned.  This is equivalent to the window of length
<var>m</var>+1 with the last coefficient removed.  The optional argument
<code>&quot;symmetric&quot;</code> is equivalent to not specifying a second argument.
</p>
<p>For a definition of the Blackman window, see, e.g.,
A.V. Oppenheim &amp; R. W. Schafer,
<cite>Discrete-Time Signal Processing</cite>.
</p></dd></dl>


<span id="XREFdetrend"></span><dl>
<dt id="index-detrend">: <em></em> <strong>detrend</strong> <em>(<var>x</var>, <var>p</var>)</em></dt>
<dd><p>If <var>x</var> is a vector, <code>detrend (<var>x</var>, <var>p</var>)</code> removes the
best fit of a polynomial of order <var>p</var> from the data <var>x</var>.
</p>
<p>If <var>x</var> is a matrix, <code>detrend (<var>x</var>, <var>p</var>)</code> does the same
for each column in <var>x</var>.
</p>
<p>The second argument <var>p</var> is optional.  If it is not specified, a value of
1 is assumed.  This corresponds to removing a linear trend.
</p>
<p>The order of the polynomial can also be given as a string, in which case
<var>p</var> must be either <code>&quot;constant&quot;</code> (corresponds to <code><var>p</var>=0</code>)
or <code>&quot;linear&quot;</code> (corresponds to <code><var>p</var>=1</code>).
</p>
<p><strong>See also:</strong> <a href="Polynomial-Interpolation.html#XREFpolyfit">polyfit</a>.
</p></dd></dl>


<span id="XREFdiffpara"></span><dl>
<dt id="index-diffpara">: <em>[<var>d</var>, <var>dd</var>] =</em> <strong>diffpara</strong> <em>(<var>x</var>, <var>a</var>, <var>b</var>)</em></dt>
<dd><p>Return the estimator <var>d</var> for the differencing parameter of an
integrated time series.
</p>
<p>The frequencies from <em>[2*pi*a/t, 2*pi*b/T]</em> are used for the
estimation.  If <var>b</var> is omitted, the interval
<em>[2*pi/T, 2*pi*a/T]</em> is used.  If both <var>b</var> and <var>a</var> are omitted
then <em>a = 0.5 * sqrt (T)</em> and <em>b = 1.5 * sqrt (T)</em> is used, where
<em>T</em> is the sample size.  If <var>x</var> is a matrix, the differencing
parameter of each column is estimated.
</p>
<p>The estimators for all frequencies in the intervals described above is
returned in <var>dd</var>.
</p>
<p>The value of <var>d</var> is simply the mean of <var>dd</var>.
</p>
<p>Reference: P.J. Brockwell &amp; R.A. Davis. <cite>Time Series:
Theory and Methods</cite>. Springer 1987.
</p></dd></dl>


<span id="XREFdurbinlevinson"></span><dl>
<dt id="index-durbinlevinson">: <em></em> <strong>durbinlevinson</strong> <em>(<var>c</var>, <var>oldphi</var>, <var>oldv</var>)</em></dt>
<dd><p>Perform one step of the Durbin-Levinson algorithm.
</p>
<p>The vector <var>c</var> specifies the autocovariances
<code>[gamma_0, &hellip;, gamma_t]</code> from lag 0 to <var>t</var>, <var>oldphi</var>
specifies the coefficients based on <var>c</var>(<var>t</var>-1) and <var>oldv</var>
specifies the corresponding error.
</p>
<p>If <var>oldphi</var> and <var>oldv</var> are omitted, all steps from 1 to <var>t</var> of
the algorithm are performed.
</p></dd></dl>


<span id="XREFfftshift"></span><dl>
<dt id="index-fftshift">: <em></em> <strong>fftshift</strong> <em>(<var>x</var>)</em></dt>
<dt id="index-fftshift-1">: <em></em> <strong>fftshift</strong> <em>(<var>x</var>, <var>dim</var>)</em></dt>
<dd><p>Perform a shift of the vector <var>x</var>, for use with the <code>fft</code> and
<code>ifft</code> functions, in order to move the frequency 0 to the center of
the vector or matrix.
</p>
<p>If <var>x</var> is a vector of <em>N</em> elements corresponding to <em>N</em> time
samples spaced by <em>dt</em>, then
<code>fftshift (fft (<var>x</var>))</code> corresponds to frequencies
</p>
<div class="example">
<pre class="example">f = [ -(ceil((N-1)/2):-1:1), 0, (1:floor((N-1)/2)) ] * df
</pre></div>

<p>where <em>df = 1 / (N * dt)</em>.
</p>
<p>If <var>x</var> is a matrix, the same holds for rows and columns.  If <var>x</var>
is an array, then the same holds along each dimension.
</p>
<p>The optional <var>dim</var> argument can be used to limit the dimension along
which the permutation occurs.
</p>
<p><strong>See also:</strong> <a href="#XREFifftshift">ifftshift</a>.
</p></dd></dl>


<span id="XREFifftshift"></span><dl>
<dt id="index-ifftshift">: <em></em> <strong>ifftshift</strong> <em>(<var>x</var>)</em></dt>
<dt id="index-ifftshift-1">: <em></em> <strong>ifftshift</strong> <em>(<var>x</var>, <var>dim</var>)</em></dt>
<dd><p>Undo the action of the <code>fftshift</code> function.
</p>
<p>For even length <var>x</var>, <code>fftshift</code> is its own inverse, but odd lengths
differ slightly.
</p>
<p><strong>See also:</strong> <a href="#XREFfftshift">fftshift</a>.
</p></dd></dl>


<span id="XREFfractdiff"></span><dl>
<dt id="index-fractdiff">: <em></em> <strong>fractdiff</strong> <em>(<var>x</var>, <var>d</var>)</em></dt>
<dd><p>Compute the fractional differences <em>(1-L)^d x</em> where <em>L</em>
denotes the lag-operator and <em>d</em> is greater than -1.
</p></dd></dl>


<span id="XREFhamming"></span><dl>
<dt id="index-hamming">: <em></em> <strong>hamming</strong> <em>(<var>m</var>)</em></dt>
<dt id="index-hamming-1">: <em></em> <strong>hamming</strong> <em>(<var>m</var>, &quot;periodic&quot;)</em></dt>
<dt id="index-hamming-2">: <em></em> <strong>hamming</strong> <em>(<var>m</var>, &quot;symmetric&quot;)</em></dt>
<dd><p>Return the filter coefficients of a Hamming window of length <var>m</var>.
</p>
<p>If the optional argument <code>&quot;periodic&quot;</code> is given, the periodic form
of the window is returned.  This is equivalent to the window of length
<var>m</var>+1 with the last coefficient removed.  The optional argument
<code>&quot;symmetric&quot;</code> is equivalent to not specifying a second argument.
</p>
<p>For a definition of the Hamming window see, e.g.,
A.V. Oppenheim &amp; R. W. Schafer,
<cite>Discrete-Time Signal Processing</cite>.
</p></dd></dl>


<span id="XREFhanning"></span><dl>
<dt id="index-hanning">: <em></em> <strong>hanning</strong> <em>(<var>m</var>)</em></dt>
<dt id="index-hanning-1">: <em></em> <strong>hanning</strong> <em>(<var>m</var>, &quot;periodic&quot;)</em></dt>
<dt id="index-hanning-2">: <em></em> <strong>hanning</strong> <em>(<var>m</var>, &quot;symmetric&quot;)</em></dt>
<dd><p>Return the filter coefficients of a Hanning window of length <var>m</var>.
</p>
<p>If the optional argument <code>&quot;periodic&quot;</code> is given, the periodic form
of the window is returned.  This is equivalent to the window of length
<var>m</var>+1 with the last coefficient removed.  The optional argument
<code>&quot;symmetric&quot;</code> is equivalent to not specifying a second argument.
</p>
<p>For a definition of the Hanning window see, e.g.,
A.V. Oppenheim &amp; R. W. Schafer,
<cite>Discrete-Time Signal Processing</cite>.
</p></dd></dl>


<span id="XREFhurst"></span><dl>
<dt id="index-hurst">: <em></em> <strong>hurst</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Estimate the Hurst parameter of sample <var>x</var> via the rescaled range
statistic.
</p>
<p>If <var>x</var> is a matrix, the parameter is estimated for every column.
</p></dd></dl>


<span id="XREFpchip"></span><dl>
<dt id="index-pchip">: <em><var>pp</var> =</em> <strong>pchip</strong> <em>(<var>x</var>, <var>y</var>)</em></dt>
<dt id="index-pchip-1">: <em><var>yi</var> =</em> <strong>pchip</strong> <em>(<var>x</var>, <var>y</var>, <var>xi</var>)</em></dt>
<dd><p>Return the Piecewise Cubic Hermite Interpolating Polynomial (pchip) of
points <var>x</var> and <var>y</var>.
</p>
<p>If called with two arguments, return the piecewise polynomial <var>pp</var>
that may be used with <code>ppval</code> to evaluate the polynomial at specific
points.
</p>
<p>When called with a third input argument, <code>pchip</code> evaluates the pchip
polynomial at the points <var>xi</var>.  The third calling form is equivalent to
<code>ppval (pchip (<var>x</var>, <var>y</var>), <var>xi</var>)</code>.
</p>
<p>The variable <var>x</var> must be a strictly monotonic vector (either increasing
or decreasing) of length <var>n</var>.
</p>
<p><var>y</var> can be either a vector or array.  If <var>y</var> is a vector then it
must be the same length <var>n</var> as <var>x</var>.  If <var>y</var> is an array then
the size of <var>y</var> must have the form
<code>[<var>s1</var>, <var>s2</var>, &hellip;, <var>sk</var>, <var>n</var>]</code>
The array is reshaped internally to a matrix where the leading dimension is
given by
<code><var>s1</var> * <var>s2</var> * &hellip; * <var>sk</var></code>
and each row of this matrix is then treated separately.  Note that this is
exactly opposite to <code>interp1</code> but is done for <small>MATLAB</small>
compatibility.
</p>

<p><strong>See also:</strong> <a href="One_002ddimensional-Interpolation.html#XREFspline">spline</a>, <a href="Polynomial-Interpolation.html#XREFppval">ppval</a>, <a href="Polynomial-Interpolation.html#XREFmkpp">mkpp</a>, <a href="Polynomial-Interpolation.html#XREFunmkpp">unmkpp</a>.
</p></dd></dl>


<span id="XREFperiodogram"></span><dl>
<dt id="index-periodogram">: <em>[<var>Pxx</var>, <var>w</var>] =</em> <strong>periodogram</strong> <em>(<var>x</var>)</em></dt>
<dt id="index-periodogram-1">: <em>[<var>Pxx</var>, <var>w</var>] =</em> <strong>periodogram</strong> <em>(<var>x</var>, <var>win</var>)</em></dt>
<dt id="index-periodogram-2">: <em>[<var>Pxx</var>, <var>w</var>] =</em> <strong>periodogram</strong> <em>(<var>x</var>, <var>win</var>, <var>nfft</var>)</em></dt>
<dt id="index-periodogram-3">: <em>[<var>Pxx</var>, <var>f</var>] =</em> <strong>periodogram</strong> <em>(<var>x</var>, <var>win</var>, <var>nfft</var>, <var>Fs</var>)</em></dt>
<dt id="index-periodogram-4">: <em>[<var>Pxx</var>, <var>f</var>] =</em> <strong>periodogram</strong> <em>(&hellip;, &quot;<var>range</var>&quot;)</em></dt>
<dt id="index-periodogram-5">: <em></em> <strong>periodogram</strong> <em>(&hellip;)</em></dt>
<dd><p>Return the periodogram (Power Spectral Density) of <var>x</var>.
</p>
<p>The possible inputs are:
</p>
<dl compact="compact">
<dt><var>x</var></dt>
<dd>
<p>data vector.  If <var>x</var> is real-valued a one-sided spectrum is estimated.
If <var>x</var> is complex-valued, or <code>&quot;<var>range</var>&quot;</code> specifies
<code>&quot;twosided&quot;</code>, the full spectrum is estimated.
</p>
</dd>
<dt><var>win</var></dt>
<dd><p>window weight data.  If window is empty or unspecified a default rectangular
window is used.  Otherwise, the window is applied to the signal
(<code><var>x</var> .* <var>win</var></code>) before computing the periodogram.  The window
data must be a vector of the same length as <var>x</var>.
</p>
</dd>
<dt><var>nfft</var></dt>
<dd><p>number of frequency bins.  The default is 256 or the next higher power of
2 greater than the length of <var>x</var>
(<code>max (256, 2.^nextpow2 (length (x)))</code>).  If <var>nfft</var> is greater
than the length of the input then <var>x</var> will be zero-padded to the length
of <var>nfft</var>.
</p>
</dd>
<dt><var>Fs</var></dt>
<dd><p>sampling rate.  The default is 1.
</p>
</dd>
<dt><var>range</var></dt>
<dd><p>range of spectrum.  <code>&quot;onesided&quot;</code> computes spectrum from
[0:nfft/2+1].  <code>&quot;twosided&quot;</code> computes spectrum from
[0:nfft-1].
</p></dd>
</dl>

<p>The optional second output <var>w</var> are the normalized angular frequencies.
For a one-sided calculation <var>w</var> is in the range [0, pi] if <var>nfft</var>
is even and [0, pi) if <var>nfft</var> is odd.  Similarly, for a two-sided
calculation <var>w</var> is in the range [0, 2*pi] or [0, 2*pi) depending on
<var>nfft</var>.
</p>
<p>If a sampling frequency is specified, <var>Fs</var>, then the output frequencies
<var>f</var> will be in the range [0, <var>Fs</var>/2] or [0, <var>Fs</var>/2) for
one-sided calculations.  For two-sided calculations the range will be
[0, <var>Fs</var>).
</p>
<p>When called with no outputs the periodogram is immediately plotted in the
current figure window.
</p>
<p><strong>See also:</strong> <a href="#XREFfft">fft</a>.
</p></dd></dl>


<span id="XREFsinetone"></span><dl>
<dt id="index-sinetone">: <em></em> <strong>sinetone</strong> <em>(<var>freq</var>, <var>rate</var>, <var>sec</var>, <var>ampl</var>)</em></dt>
<dd><p>Return a sinetone of frequency <var>freq</var> with a length of <var>sec</var>
seconds at sampling rate <var>rate</var> and with amplitude <var>ampl</var>.
</p>
<p>The arguments <var>freq</var> and <var>ampl</var> may be vectors of common size.
</p>
<p>The defaults are <var>rate</var> = 8000, <var>sec</var> = 1, and <var>ampl</var> = 64.
</p>
<p><strong>See also:</strong> <a href="#XREFsinewave">sinewave</a>.
</p></dd></dl>


<span id="XREFsinewave"></span><dl>
<dt id="index-sinewave">: <em></em> <strong>sinewave</strong> <em>(<var>m</var>, <var>n</var>, <var>d</var>)</em></dt>
<dd><p>Return an <var>m</var>-element vector with <var>i</var>-th element given by
<code>sin (2 * pi * (<var>i</var>+<var>d</var>-1) / <var>n</var>)</code>.
</p>
<p>The default value for <var>d</var> is 0 and the default value for <var>n</var> is
<var>m</var>.
</p>
<p><strong>See also:</strong> <a href="#XREFsinetone">sinetone</a>.
</p></dd></dl>


<span id="XREFspectral_005fadf"></span><dl>
<dt id="index-spectral_005fadf">: <em></em> <strong>spectral_adf</strong> <em>(<var>c</var>)</em></dt>
<dt id="index-spectral_005fadf-1">: <em></em> <strong>spectral_adf</strong> <em>(<var>c</var>, <var>win</var>)</em></dt>
<dt id="index-spectral_005fadf-2">: <em></em> <strong>spectral_adf</strong> <em>(<var>c</var>, <var>win</var>, <var>b</var>)</em></dt>
<dd><p>Return the spectral density estimator given a vector of autocovariances
<var>c</var>, window name <var>win</var>, and bandwidth, <var>b</var>.
</p>
<p>The window name, e.g., <code>&quot;triangle&quot;</code> or <code>&quot;rectangle&quot;</code> is
used to search for a function called <code><var>win</var>_lw</code>.
</p>
<p>If <var>win</var> is omitted, the triangle window is used.
</p>
<p>If <var>b</var> is omitted, <code>1 / sqrt (length (<var>x</var>))</code> is used.
</p>
<p><strong>See also:</strong> <a href="#XREFspectral_005fxdf">spectral_xdf</a>.
</p></dd></dl>


<span id="XREFspectral_005fxdf"></span><dl>
<dt id="index-spectral_005fxdf">: <em></em> <strong>spectral_xdf</strong> <em>(<var>x</var>)</em></dt>
<dt id="index-spectral_005fxdf-1">: <em></em> <strong>spectral_xdf</strong> <em>(<var>x</var>, <var>win</var>)</em></dt>
<dt id="index-spectral_005fxdf-2">: <em></em> <strong>spectral_xdf</strong> <em>(<var>x</var>, <var>win</var>, <var>b</var>)</em></dt>
<dd><p>Return the spectral density estimator given a data vector <var>x</var>, window
name <var>win</var>, and bandwidth, <var>b</var>.
</p>
<p>The window name, e.g., <code>&quot;triangle&quot;</code> or <code>&quot;rectangle&quot;</code> is used to
search for a function called <code><var>win</var>_sw</code>.
</p>
<p>If <var>win</var> is omitted, the triangle window is used.
</p>
<p>If <var>b</var> is omitted, <code>1 / sqrt (length (<var>x</var>))</code> is used.
</p>
<p><strong>See also:</strong> <a href="#XREFspectral_005fadf">spectral_adf</a>.
</p></dd></dl>


<span id="XREFspencer"></span><dl>
<dt id="index-spencer">: <em></em> <strong>spencer</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Return Spencer&rsquo;s 15-point moving average of each column of
<var>x</var>.
</p></dd></dl>


<span id="XREFstft"></span><dl>
<dt id="index-stft">: <em><var>y</var> =</em> <strong>stft</strong> <em>(<var>x</var>)</em></dt>
<dt id="index-stft-1">: <em><var>y</var> =</em> <strong>stft</strong> <em>(<var>x</var>, <var>win_size</var>)</em></dt>
<dt id="index-stft-2">: <em><var>y</var> =</em> <strong>stft</strong> <em>(<var>x</var>, <var>win_size</var>, <var>inc</var>)</em></dt>
<dt id="index-stft-3">: <em><var>y</var> =</em> <strong>stft</strong> <em>(<var>x</var>, <var>win_size</var>, <var>inc</var>, <var>num_coef</var>)</em></dt>
<dt id="index-stft-4">: <em><var>y</var> =</em> <strong>stft</strong> <em>(<var>x</var>, <var>win_size</var>, <var>inc</var>, <var>num_coef</var>, <var>win_type</var>)</em></dt>
<dt id="index-stft-5">: <em>[<var>y</var>, <var>c</var>] =</em> <strong>stft</strong> <em>(&hellip;)</em></dt>
<dd><p>Compute the short-time Fourier transform of the vector <var>x</var> with
<var>num_coef</var> coefficients by applying a window of <var>win_size</var> data
points and an increment of <var>inc</var> points.
</p>
<p>Before computing the Fourier transform, one of the following windows
is applied:
</p>
<dl compact="compact">
<dt><code>&quot;hanning&quot;</code></dt>
<dd><p>win_type = 1
</p>
</dd>
<dt><code>&quot;hamming&quot;</code></dt>
<dd><p>win_type = 2
</p>
</dd>
<dt><code>&quot;rectangle&quot;</code></dt>
<dd><p>win_type = 3
</p></dd>
</dl>

<p>The window names can be passed as strings or by the <var>win_type</var> number.
</p>
<p>The following defaults are used for unspecified arguments:
<var>win_size</var> = 80, <var>inc</var> = 24, <var>num_coef</var> = 64, and
<var>win_type</var> = 1.
</p>
<p><code><var>y</var> = stft (<var>x</var>, &hellip;)</code> returns the absolute values of the
Fourier coefficients according to the <var>num_coef</var> positive frequencies.
</p>
<p><code>[<var>y</var>, <var>c</var>] = stft (<var>x</var>, &hellip;)</code> returns the entire
STFT-matrix <var>y</var> and a 3-element vector <var>c</var> containing the window
size, increment, and window type, which is needed by the <code>synthesis</code>
function.
</p>
<p><strong>See also:</strong> <a href="#XREFsynthesis">synthesis</a>.
</p></dd></dl>


<span id="XREFsynthesis"></span><dl>
<dt id="index-synthesis">: <em><var>x</var> =</em> <strong>synthesis</strong> <em>(<var>y</var>, <var>c</var>)</em></dt>
<dd><p>Compute a signal from its short-time Fourier transform <var>y</var> and a
3-element vector <var>c</var> specifying window size, increment, and window type.
</p>
<p>The values <var>y</var> and <var>c</var> can be derived by
</p>
<div class="example">
<pre class="example">[<var>y</var>, <var>c</var>] = stft (<var>x</var> , &hellip;)
</pre></div>

<p><strong>See also:</strong> <a href="#XREFstft">stft</a>.
</p></dd></dl>


<span id="XREFyulewalker"></span><dl>
<dt id="index-yulewalker">: <em>[<var>a</var>, <var>v</var>] =</em> <strong>yulewalker</strong> <em>(<var>c</var>)</em></dt>
<dd><p>Fit an AR (p)-model with Yule-Walker estimates given a vector <var>c</var> of
autocovariances <code>[gamma_0, &hellip;, gamma_p]</code>.
</p>
<p>Returns the AR coefficients, <var>a</var>, and the variance of white noise,
<var>v</var>.
</p></dd></dl>



<hr>
<div class="header">
<p>
Next: <a href="Image-Processing.html" accesskey="n" rel="next">Image Processing</a>, Previous: <a href="Geometry.html" accesskey="p" rel="prev">Geometry</a>, Up: <a href="index.html" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>