File: octave_27.html

package info (click to toggle)
octave 2.0.16-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 26,276 kB
  • ctags: 16,450
  • sloc: cpp: 67,548; fortran: 41,514; ansic: 26,682; sh: 7,361; makefile: 4,077; lex: 2,008; yacc: 1,849; lisp: 1,702; perl: 1,676; exp: 123
file content (251 lines) | stat: -rw-r--r-- 7,252 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
<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.51
     from ./octave.texi on 18 June 1999 -->

<TITLE>GNU Octave - Signal Processing</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="octave_1.html">first</A>, <A HREF="octave_26.html">previous</A>, <A HREF="octave_28.html">next</A>, <A HREF="octave_40.html">last</A> section, <A HREF="octave_toc.html">table of contents</A>.
<P><HR><P>


<H1><A NAME="SEC162" HREF="octave_toc.html#TOC162">Signal Processing</A></H1>

<P>
I hope that someday Octave will include more signal processing
functions.  If you would like to help improve Octave in this area,
please contact @email{bug-octave@bevo.che.wisc.edu}.

</P>
<P>
<DL>
<DT><U>Function File:</U>  <B>detrend</B> <I>(<VAR>x</VAR>, <VAR>p</VAR>)</I>
<DD><A NAME="IDX803"></A>
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 is optional.  If it is not specified, a value of 1
is assumed.  This corresponds to removing a linear trend.
</DL>

</P>
<P>
<DL>
<DT><U>Function:</U>  <B>fft</B> <I>(<VAR>a</VAR>, <VAR>n</VAR>)</I>
<DD><A NAME="IDX804"></A>
Compute the FFT of <VAR>a</VAR> using subroutines from FFTPACK.  If <VAR>a</VAR>
is a matrix, <CODE>fft</CODE> computes the FFT for each column of <VAR>a</VAR>.

</P>
<P>
If called with two arguments, <VAR>n</VAR> is expected to be an integer
specifying the number of elements of <VAR>a</VAR> to use.  If <VAR>a</VAR> is a
matrix, <VAR>n</VAR> specifies the number of rows of <VAR>a</VAR> to use.  If
<VAR>n</VAR> is larger than the size of <VAR>a</VAR>, <VAR>a</VAR> is resized and
padded with zeros.
</DL>

</P>
<P>
<DL>
<DT><U>Loadable Function:</U>  <B>ifft</B> <I>(<VAR>a</VAR>, <VAR>n</VAR>)</I>
<DD><A NAME="IDX805"></A>
Compute the inverse FFT of <VAR>a</VAR> using subroutines from FFTPACK.  If
<VAR>a</VAR> is a matrix, <CODE>fft</CODE> computes the inverse FFT for each column
of <VAR>a</VAR>.

</P>
<P>
If called with two arguments, <VAR>n</VAR> is expected to be an integer
specifying the number of elements of <VAR>a</VAR> to use.  If <VAR>a</VAR> is a
matrix, <VAR>n</VAR> specifies the number of rows of <VAR>a</VAR> to use.  If
<VAR>n</VAR> is larger than the size of <VAR>a</VAR>, <VAR>a</VAR> is resized and
padded with zeros.
</DL>

</P>
<P>
<DL>
<DT><U>Loadable Function:</U>  <B>fft2</B> <I>(<VAR>a</VAR>, <VAR>n</VAR>, <VAR>m</VAR>)</I>
<DD><A NAME="IDX806"></A>
Compute the two dimensional FFT of <VAR>a</VAR>.

</P>
<P>
The optional arguments <VAR>n</VAR> and <VAR>m</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.
</DL>

</P>
<P>
<DL>
<DT><U>Loadable Function:</U>  <B>ifft2</B> <I>(<VAR>a</VAR>, <VAR>n</VAR>, <VAR>m</VAR>)</I>
<DD><A NAME="IDX807"></A>
Compute the two dimensional inverse FFT of <VAR>a</VAR>.

</P>
<P>
The optional arguments <VAR>n</VAR> and <VAR>m</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.
</DL>

</P>
<P>
<DL>
<DT><U>Built-in Function:</U>  <B>fftconv</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>, <VAR>n</VAR>)</I>
<DD><A NAME="IDX808"></A>
Return the convolution of the vectors <VAR>a</VAR> and <VAR>b</VAR>, as a vector
with length equal to the <CODE>length (a) + length (b) - 1</CODE>.  If <VAR>a</VAR>
and <VAR>b</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.
</DL>

</P>
<P>
<DL>
<DT><U>Function File:</U>  <B>fftfilt</B> <I>(<VAR>b</VAR>, <VAR>x</VAR>, <VAR>n</VAR>)</I>
<DD><A NAME="IDX809"></A>

</P>
<P>
With two arguments, <CODE>fftfilt</CODE> filters <VAR>x</VAR> with the FIR filter
<VAR>b</VAR> using the FFT.

</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.
</DL>

</P>
<P>
<DL>
<DT><U>Loadable Function:</U> y = <B>filter</B> <I>(<VAR>b</VAR>, <VAR>a</VAR>, <VAR>x</VAR>)</I>
<DD><A NAME="IDX810"></A>
Return the solution to the following linear, time-invariant difference
equation:

</P>

<PRE>
   N                   M
  SUM a(k+1) y(n-k) = SUM b(k+1) x(n-k)      for 1&#60;=n&#60;=length(x)
  k=0                 k=0
</PRE>

<P>
where
 N=length(a)-1 and M=length(b)-1.
An equivalent form of this equation is:

</P>

<PRE>
            N                   M
  y(n) = - SUM c(k+1) y(n-k) + SUM d(k+1) x(n-k)  for 1&#60;=n&#60;=length(x)
           k=1                 k=0
</PRE>

<P>
where
 c = a/a(1) and d = b/a(1).

</P>
<P>
In terms of the z-transform, y is the result of passing the discrete-
time signal x through a system characterized by the following rational
system function:

</P>

<PRE>
             M
            SUM d(k+1) z^(-k)
            k=0
  H(z) = ----------------------
               N
          1 + SUM c(k+1) z(-k)
              k=1
</PRE>

</DL>

<P>
<DL>
<DT><U>Loadable Function:</U> [<VAR>y</VAR>, <VAR>sf</VAR>] = <B>filter</B> <I>(<VAR>b</VAR>, <VAR>a</VAR>, <VAR>x</VAR>, <VAR>si</VAR>)</I>
<DD><A NAME="IDX811"></A>
This is the same as the <CODE>filter</CODE> function described above, except
that <VAR>si</VAR> 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 set, the initial state vector is set to
all zeros.
</DL>

</P>
<P>
<DL>
<DT><U>Function File:</U> [<VAR>h</VAR>, <VAR>w</VAR>] = <B>freqz</B> <I>(<VAR>b</VAR>, <VAR>a</VAR>, <VAR>n</VAR>, "whole")</I>
<DD><A NAME="IDX812"></A>
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.  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 the fourth argument is omitted, the response is evaluated at
frequencies between 0 and
 pi.

</P>
<P>
If <VAR>n</VAR> is omitted, a value of 512 is assumed.

</P>
<P>
If <VAR>a</VAR> is omitted, the denominator is assumed to be 1 (this
corresponds to a simple FIR filter).

</P>
<P>
For fastest computation, <VAR>n</VAR> should factor into a small number of
small primes.
</DL>

</P>
<P>
<DL>
<DT><U>Function File:</U>  <B>sinc</B> <I>(<VAR>x</VAR>)</I>
<DD><A NAME="IDX813"></A>
Return
 sin(pi*x)/(pi*x).
</DL>

</P>
<P><HR><P>
Go to the <A HREF="octave_1.html">first</A>, <A HREF="octave_26.html">previous</A>, <A HREF="octave_28.html">next</A>, <A HREF="octave_40.html">last</A> section, <A HREF="octave_toc.html">table of contents</A>.
</BODY>
</HTML>