]> Creatis software - CreaPhase.git/blob - octave_packages/signal-1.1.3/doc-cache
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / signal-1.1.3 / doc-cache
1 # Created by Octave 3.6.1, Thu May 17 20:38:50 2012 UTC <root@brouzouf>
2 # name: cache
3 # type: cell
4 # rows: 3
5 # columns: 130
6 # name: <cell-element>
7 # type: sq_string
8 # elements: 1
9 # length: 6
10 ar_psd
11
12
13 # name: <cell-element>
14 # type: sq_string
15 # elements: 1
16 # length: 4320
17  Usage:
18    [psd,f_out] = ar_psd(a,v,freq,Fs,range,method,plot_type)
19
20   Calculate the power spectrum of the autoregressive model
21
22                          M
23   x(n) = sqrt(v).e(n) + SUM a(k).x(n-k)
24                         k=1
25   where x(n) is the output of the model and e(n) is white noise.
26   This function is intended for use with 
27     [a,v,k] = arburg(x,poles,criterion)
28   which use the Burg (1968) method to calculate a "maximum entropy"
29   autoregressive model of "x".  This function runs on octave and matlab.
30   
31   If the "freq" argument is a vector (of frequencies) the spectrum is
32   calculated using the polynomial method and the "method" argument is
33   ignored.  For scalar "freq", an integer power of 2, or "method='FFT'",
34   causes the spectrum to be calculated by FFT.  Otherwise, the spectrum
35   is calculated as a polynomial.  It may be computationally more
36   efficient to use the FFT method if length of the model is not much
37   smaller than the number of frequency values. The spectrum is scaled so
38   that spectral energy (area under spectrum) is the same as the
39   time-domain energy (mean square of the signal).
40
41  ARGUMENTS:
42      All but the first two arguments are optional and may be empty.
43
44    a      %% [vector] list of M=(order+1) autoregressive model
45           %%      coefficients.  The first element of "ar_coeffs" is the
46           %%      zero-lag coefficient, which always has a value of 1.
47
48    v      %% [real scalar] square of the moving-average coefficient of
49           %%               the AR model.
50
51    freq   %% [real vector] frequencies at which power spectral density
52           %%               is calculated
53           %% [integer scalar] number of uniformly distributed frequency
54           %%          values at which spectral density is calculated.
55           %%          [default=256]
56
57    Fs     %% [real scalar] sampling frequency (Hertz) [default=1]
58
59  CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
60    Control-string arguments can be in any order after the other arguments.
61
62    range  %% 'half',  'onesided' : frequency range of the spectrum is
63           %%       from zero up to but not including sample_f/2.  Power
64           %%       from negative frequencies is added to the positive
65           %%       side of the spectrum.
66           %% 'whole', 'twosided' : frequency range of the spectrum is
67           %%       -sample_f/2 to sample_f/2, with negative frequencies
68           %%       stored in "wrap around" order after the positive
69           %%       frequencies; e.g. frequencies for a 10-point 'twosided'
70           %%       spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
71           %% 'shift', 'centerdc' : same as 'whole' but with the first half
72           %%       of the spectrum swapped with second half to put the
73           %%       zero-frequency value in the middle. (See "help
74           %%       fftshift". If "freq" is vector, 'shift' is ignored.
75           %% If model coefficients "ar_coeffs" are real, the default
76           %% range is 'half', otherwise default range is 'whole'.
77
78    method %% 'fft':  use FFT to calculate power spectrum.
79           %% 'poly': calculate power spectrum as a polynomial of 1/z
80           %% N.B. this argument is ignored if the "freq" argument is a
81           %%      vector.  The default is 'poly' unless the "freq"
82           %%      argument is an integer power of 2.
83    
84  plot_type%% 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
85           %% specifies the type of plot.  The default is 'plot', which
86           %% means linear-linear axes. 'squared' is the same as 'plot'.
87           %% 'dB' plots "10*log10(psd)".  This argument is ignored and a
88           %% spectrum is not plotted if the caller requires a returned
89           %% value.
90
91  RETURNED VALUES:
92      If returned values are not required by the caller, the spectrum
93      is plotted and nothing is returned.
94    psd    %% [real vector] estimate of power-spectral density
95    f_out  %% [real vector] frequency values 
96
97  N.B. arburg runs in octave and matlab, and does not depend on octave-forge
98       or signal-processing-toolbox functions.
99
100  REFERENCE
101  [1] Equation 2.28 from Steven M. Kay and Stanley Lawrence Marple Jr.:
102    "Spectrum analysis -- a modern perspective",
103    Proceedings of the IEEE, Vol 69, pp 1380-1419, Nov., 1981
104
105
106
107
108 # name: <cell-element>
109 # type: sq_string
110 # elements: 1
111 # length: 68
112  Usage:
113    [psd,f_out] = ar_psd(a,v,freq,Fs,range,method,plot_type)
114
115
116
117
118 # name: <cell-element>
119 # type: sq_string
120 # elements: 1
121 # length: 6
122 arburg
123
124
125 # name: <cell-element>
126 # type: sq_string
127 # elements: 1
128 # length: 4080
129  [a,v,k] = arburg(x,poles,criterion)
130
131  Calculate coefficients of an autoregressive (AR) model of complex data
132  "x" using the whitening lattice-filter method of Burg (1968).  The inverse
133  of the model is a moving-average filter which reduces "x" to white noise.
134  The power spectrum of the AR model is an estimate of the maximum
135  entropy power spectrum of the data.  The function "ar_psd" calculates the
136  power spectrum of the AR model.
137
138  ARGUMENTS:
139    x         %% [vector] sampled data
140
141    poles     %% [integer scalar] number of poles in the AR model or
142              %%       limit to the number of poles if a
143              %%       valid "stop_crit" is provided.
144
145    criterion %% [optional string arg]  model-selection criterion.  Limits
146              %%       the number of poles so that spurious poles are not 
147              %%       added when the whitened data has no more information
148              %%       in it (see Kay & Marple, 1981). Recognised values are
149              %%  'AKICc' -- approximate corrected Kullback information
150              %%             criterion (recommended),
151              %%   'KIC'  -- Kullback information criterion
152              %%   'AICc' -- corrected Akaike information criterion
153              %%   'AIC'  -- Akaike information criterion
154              %%   'FPE'  -- final prediction error" criterion
155              %% The default is to NOT use a model-selection criterion
156
157  RETURNED VALUES:
158    a         %% [polynomial/vector] list of (P+1) autoregression coeffic-
159              %%       ients; for data input x(n) and  white noise e(n),
160              %%       the model is
161              %%                             P+1
162              %%       x(n) = sqrt(v).e(n) + SUM a(k).x(n-k)
163              %%                             k=1
164
165    v         %% [real scalar] mean square of residual noise from the
166              %%       whitening operation of the Burg lattice filter.
167
168    k         %% [column vector] reflection coefficients defining the
169              %%       lattice-filter embodiment of the model
170
171  HINTS:
172   (1) arburg does not remove the mean from the data.  You should remove
173       the mean from the data if you want a power spectrum.  A non-zero mean
174       can produce large errors in a power-spectrum estimate.  See
175       "help detrend".
176   (2) If you don't know what the value of "poles" should be, choose the
177       largest (reasonable) value you could want and use the recommended
178       value, criterion='AKICc', so that arburg can find it.
179       E.g. arburg(x,64,'AKICc')
180       The AKICc has the least bias and best resolution of the available
181       model-selection criteria.
182   (3) arburg runs in octave and matlab, does not depend on octave forge
183       or signal-processing-toolbox functions.
184   (4) Autoregressive and moving-average filters are stored as polynomials
185       which, in matlab, are row vectors.
186
187  NOTE ON SELECTION CRITERION
188    AIC, AICc, KIC and AKICc are based on information theory.  They  attempt
189    to balance the complexity (or length) of the model against how well the
190    model fits the data.  AIC and KIC are biassed estimates of the asymmetric
191    and the symmetric Kullback-Leibler divergence respectively.  AICc and
192    AKICc attempt to correct the bias. See reference [4].
193
194
195  REFERENCES
196  [1] John Parker Burg (1968)
197    "A new analysis technique for time series data",
198    NATO advanced study Institute on Signal Processing with Emphasis on
199    Underwater Acoustics, Enschede, Netherlands, Aug. 12-23, 1968.
200
201  [2] Steven M. Kay and Stanley Lawrence Marple Jr.:
202    "Spectrum analysis -- a modern perspective",
203    Proceedings of the IEEE, Vol 69, pp 1380-1419, Nov., 1981
204
205  [3] William H. Press and Saul A. Teukolsky and William T. Vetterling and
206                Brian P. Flannery
207    "Numerical recipes in C, The art of scientific computing", 2nd edition,
208    Cambridge University Press, 2002 --- Section 13.7.
209
210  [4] Abd-Krim Seghouane and Maiza Bekara
211    "A small sample model selection criterion based on Kullback's symmetric
212    divergence", IEEE Transactions on Signal Processing,
213    Vol. 52(12), pp 3314-3323, Dec. 2004
214
215
216
217 # name: <cell-element>
218 # type: sq_string
219 # elements: 1
220 # length: 37
221  [a,v,k] = arburg(x,poles,criterion)
222
223
224
225
226 # name: <cell-element>
227 # type: sq_string
228 # elements: 1
229 # length: 6
230 aryule
231
232
233 # name: <cell-element>
234 # type: sq_string
235 # elements: 1
236 # length: 799
237  usage:  [a, v, k] = aryule (x, p)
238  
239  fits an AR (p)-model with Yule-Walker estimates.
240  x = data vector to estimate
241  a: AR coefficients
242  v: variance of white noise
243  k: reflection coeffients for use in lattice filter 
244
245  The power spectrum of the resulting filter can be plotted with
246  pyulear(x, p), or you can plot it directly with ar_psd(a,v,...).
247
248  See also:
249  pyulear, power, freqz, impz -- for observing characteristics of the model
250  arburg -- for alternative spectral estimators
251
252  Example: Use example from arburg, but substitute aryule for arburg.
253
254  Note: Orphanidis '85 claims lattice filters are more tolerant of 
255  truncation errors, which is why you might want to use them.  However,
256  lacking a lattice filter processor, I haven't tested that the lattice
257  filter coefficients are reasonable.
258
259
260
261 # name: <cell-element>
262 # type: sq_string
263 # elements: 1
264 # length: 80
265  usage:  [a, v, k] = aryule (x, p)
266  
267  fits an AR (p)-model with Yule-Walker esti
268
269
270
271 # name: <cell-element>
272 # type: sq_string
273 # elements: 1
274 # length: 11
275 barthannwin
276
277
278 # name: <cell-element>
279 # type: sq_string
280 # elements: 1
281 # length: 136
282  -- Function File: [W] = barthannwin(L)
283      Compute the modified Bartlett-Hann window of lenght L.
284
285      See also: rectwin, bartlett
286
287
288
289
290
291 # name: <cell-element>
292 # type: sq_string
293 # elements: 1
294 # length: 54
295 Compute the modified Bartlett-Hann window of lenght L.
296
297
298
299 # name: <cell-element>
300 # type: sq_string
301 # elements: 1
302 # length: 8
303 besselap
304
305
306 # name: <cell-element>
307 # type: sq_string
308 # elements: 1
309 # length: 105
310  Return bessel analog filter prototype.
311
312  References: 
313
314  http://en.wikipedia.org/wiki/Bessel_polynomials
315
316
317
318 # name: <cell-element>
319 # type: sq_string
320 # elements: 1
321 # length: 39
322  Return bessel analog filter prototype.
323
324
325
326 # name: <cell-element>
327 # type: sq_string
328 # elements: 1
329 # length: 7
330 besself
331
332
333 # name: <cell-element>
334 # type: sq_string
335 # elements: 1
336 # length: 804
337  Generate a bessel filter.
338  Default is a Laplace space (s) filter.
339  
340  [b,a] = besself(n, Wc)
341     low pass filter with cutoff pi*Wc radians
342
343  [b,a] = besself(n, Wc, 'high')
344     high pass filter with cutoff pi*Wc radians
345
346  [b,a] = besself(n, [Wl, Wh])
347     band pass filter with edges pi*Wl and pi*Wh radians
348
349  [b,a] = besself(n, [Wl, Wh], 'stop')
350     band reject filter with edges pi*Wl and pi*Wh radians
351
352  [z,p,g] = besself(...)
353     return filter as zero-pole-gain rather than coefficients of the
354     numerator and denominator polynomials.
355  
356  [...] = besself(...,'z')
357      return a discrete space (Z) filter, W must be less than 1.
358  
359  [a,b,c,d] = besself(...)
360   return  state-space matrices 
361
362  References: 
363
364  Proakis & Manolakis (1992). Digital Signal Processing. New York:
365  Macmillan Publishing Company.
366
367
368
369 # name: <cell-element>
370 # type: sq_string
371 # elements: 1
372 # length: 26
373  Generate a bessel filter.
374
375
376
377 # name: <cell-element>
378 # type: sq_string
379 # elements: 1
380 # length: 8
381 bilinear
382
383
384 # name: <cell-element>
385 # type: sq_string
386 # elements: 1
387 # length: 2658
388  usage: [Zz, Zp, Zg] = bilinear(Sz, Sp, Sg, T)
389         [Zb, Za] = bilinear(Sb, Sa, T)
390
391  Transform a s-plane filter specification into a z-plane
392  specification. Filters can be specified in either zero-pole-gain or
393  transfer function form. The input form does not have to match the
394  output form. 1/T is the sampling frequency represented in the z plane.
395
396  Note: this differs from the bilinear function in the signal processing
397  toolbox, which uses 1/T rather than T.
398
399  Theory: Given a piecewise flat filter design, you can transform it
400  from the s-plane to the z-plane while maintaining the band edges by
401  means of the bilinear transform.  This maps the left hand side of the
402  s-plane into the interior of the unit circle.  The mapping is highly
403  non-linear, so you must design your filter with band edges in the
404  s-plane positioned at 2/T tan(w*T/2) so that they will be positioned
405  at w after the bilinear transform is complete.
406
407  The following table summarizes the transformation:
408
409  +---------------+-----------------------+----------------------+
410  | Transform     | Zero at x             | Pole at x            |
411  |    H(S)       |   H(S) = S-x          |    H(S)=1/(S-x)      |
412  +---------------+-----------------------+----------------------+
413  |       2 z-1   | zero: (2+xT)/(2-xT)   | zero: -1             |
414  |  S -> - ---   | pole: -1              | pole: (2+xT)/(2-xT)  |
415  |       T z+1   | gain: (2-xT)/T        | gain: (2-xT)/T       |
416  +---------------+-----------------------+----------------------+
417
418  With tedious algebra, you can derive the above formulae yourself by
419  substituting the transform for S into H(S)=S-x for a zero at x or
420  H(S)=1/(S-x) for a pole at x, and converting the result into the
421  form:
422
423     H(Z)=g prod(Z-Xi)/prod(Z-Xj)
424
425  Please note that a pole and a zero at the same place exactly cancel.
426  This is significant since the bilinear transform creates numerous
427  extra poles and zeros, most of which cancel. Those which do not
428  cancel have a "fill-in" effect, extending the shorter of the sets to
429  have the same number of as the longer of the sets of poles and zeros
430  (or at least split the difference in the case of the band pass
431  filter). There may be other opportunistic cancellations but I will
432  not check for them.
433
434  Also note that any pole on the unit circle or beyond will result in
435  an unstable filter.  Because of cancellation, this will only happen
436  if the number of poles is smaller than the number of zeros.  The
437  analytic design methods all yield more poles than zeros, so this will
438  not be a problem.
439
440  References:
441
442  Proakis & Manolakis (1992). Digital Signal Processing. New York:
443  Macmillan Publishing Company.
444
445
446
447 # name: <cell-element>
448 # type: sq_string
449 # elements: 1
450 # length: 80
451  usage: [Zz, Zp, Zg] = bilinear(Sz, Sp, Sg, T)
452         [Zb, Za] = bilinear(Sb, S
453
454
455
456 # name: <cell-element>
457 # type: sq_string
458 # elements: 1
459 # length: 11
460 bitrevorder
461
462
463 # name: <cell-element>
464 # type: sq_string
465 # elements: 1
466 # length: 111
467  -- Function File: [Y I] = bitrevorder(X)
468      Reorder x in the bit reversed order
469
470      See also: fft, ifft
471
472
473
474
475
476 # name: <cell-element>
477 # type: sq_string
478 # elements: 1
479 # length: 36
480 Reorder x in the bit reversed order
481
482
483
484
485 # name: <cell-element>
486 # type: sq_string
487 # elements: 1
488 # length: 14
489 blackmanharris
490
491
492 # name: <cell-element>
493 # type: sq_string
494 # elements: 1
495 # length: 120
496  -- Function File: [W] = blackmanharris(L)
497      Compute the Blackman-Harris window.
498
499      See also: rectwin, bartlett
500
501
502
503
504
505 # name: <cell-element>
506 # type: sq_string
507 # elements: 1
508 # length: 35
509 Compute the Blackman-Harris window.
510
511
512
513 # name: <cell-element>
514 # type: sq_string
515 # elements: 1
516 # length: 15
517 blackmannuttall
518
519
520 # name: <cell-element>
521 # type: sq_string
522 # elements: 1
523 # length: 123
524  -- Function File: [W] = blackmannuttall(L)
525      Compute the Blackman-Nuttall window.
526
527      See also: nuttallwin, kaiser
528
529
530
531
532
533 # name: <cell-element>
534 # type: sq_string
535 # elements: 1
536 # length: 36
537 Compute the Blackman-Nuttall window.
538
539
540
541 # name: <cell-element>
542 # type: sq_string
543 # elements: 1
544 # length: 9
545 bohmanwin
546
547
548 # name: <cell-element>
549 # type: sq_string
550 # elements: 1
551 # length: 118
552  -- Function File: [W] = bohmanwin(L)
553      Compute the Bohman window of lenght L.
554
555      See also: rectwin, bartlett
556
557
558
559
560
561 # name: <cell-element>
562 # type: sq_string
563 # elements: 1
564 # length: 38
565 Compute the Bohman window of lenght L.
566
567
568
569 # name: <cell-element>
570 # type: sq_string
571 # elements: 1
572 # length: 6
573 boxcar
574
575
576 # name: <cell-element>
577 # type: sq_string
578 # elements: 1
579 # length: 95
580  usage:  w = boxcar (n)
581
582  Returns the filter coefficients of a rectangular window of length n.
583
584
585
586 # name: <cell-element>
587 # type: sq_string
588 # elements: 1
589 # length: 24
590  usage:  w = boxcar (n)
591
592
593
594
595 # name: <cell-element>
596 # type: sq_string
597 # elements: 1
598 # length: 6
599 buffer
600
601
602 # name: <cell-element>
603 # type: sq_string
604 # elements: 1
605 # length: 1473
606  -- Function File: Y =  buffer (X, N, P, OPT)
607  -- Function File: [Y, Z, OPT] =  buffer (...)
608      Buffer a signal into a data frame. The arguments to `buffer' are
609
610     X
611           The data to be buffered.
612
613     N
614           The number of rows in the produced data buffer. This is an
615           positive integer value and must be supplied.
616
617     P
618           An integer less than N that specifies the under- or overlap
619           between column in the data frame. The default value of P is 0.
620
621     OPT
622           In the case of an overlap, OPT can be either a vector of
623           length P or the string 'nodelay'. If OPT is a vector, then the
624           first P entries in Y will be filled with these values. If OPT
625           is the string 'nodelay', then the first value of Y
626           corresponds to the first value of X.
627
628           In the can of an underlap, OPT must be an integer between 0
629           and `-P'. The represents the initial underlap of the first
630           column of Y.
631
632           The default value for OPT the vector `zeros (1, P)' in the
633           case of an overlap, or 0 otherwise.
634
635      In the case of a single output argument, Y will be padded with
636      zeros to fill the missing values in the data frame. With two output
637      arguments Z is the remaining data that has not been used in the
638      current data frame.
639
640      Likewise, the output OPT is the overlap, or underlap that might be
641      used for a future call to `code' to allow continuous buffering.
642
643
644
645
646 # name: <cell-element>
647 # type: sq_string
648 # elements: 1
649 # length: 34
650 Buffer a signal into a data frame.
651
652
653
654 # name: <cell-element>
655 # type: sq_string
656 # elements: 1
657 # length: 6
658 butter
659
660
661 # name: <cell-element>
662 # type: sq_string
663 # elements: 1
664 # length: 799
665  Generate a butterworth filter.
666  Default is a discrete space (Z) filter.
667  
668  [b,a] = butter(n, Wc)
669     low pass filter with cutoff pi*Wc radians
670
671  [b,a] = butter(n, Wc, 'high')
672     high pass filter with cutoff pi*Wc radians
673
674  [b,a] = butter(n, [Wl, Wh])
675     band pass filter with edges pi*Wl and pi*Wh radians
676
677  [b,a] = butter(n, [Wl, Wh], 'stop')
678     band reject filter with edges pi*Wl and pi*Wh radians
679
680  [z,p,g] = butter(...)
681     return filter as zero-pole-gain rather than coefficients of the
682     numerator and denominator polynomials.
683  
684  [...] = butter(...,'s')
685      return a Laplace space filter, W can be larger than 1.
686  
687  [a,b,c,d] = butter(...)
688   return  state-space matrices 
689
690  References: 
691
692  Proakis & Manolakis (1992). Digital Signal Processing. New York:
693  Macmillan Publishing Company.
694
695
696
697 # name: <cell-element>
698 # type: sq_string
699 # elements: 1
700 # length: 31
701  Generate a butterworth filter.
702
703
704
705 # name: <cell-element>
706 # type: sq_string
707 # elements: 1
708 # length: 7
709 buttord
710
711
712 # name: <cell-element>
713 # type: sq_string
714 # elements: 1
715 # length: 1107
716  Compute butterworth filter order and cutoff for the desired response
717  characteristics. Rp is the allowable decibels of ripple in the pass 
718  band. Rs is the minimum attenuation in the stop band.
719
720  [n, Wc] = buttord(Wp, Ws, Rp, Rs)
721      Low pass (Wp<Ws) or high pass (Wp>Ws) filter design.  Wp is the
722      pass band edge and Ws is the stop band edge.  Frequencies are
723      normalized to [0,1], corresponding to the range [0,Fs/2].
724  
725  [n, Wc] = buttord([Wp1, Wp2], [Ws1, Ws2], Rp, Rs)
726      Band pass (Ws1<Wp1<Wp2<Ws2) or band reject (Wp1<Ws1<Ws2<Wp2)
727      filter design. Wp gives the edges of the pass band, and Ws gives
728      the edges of the stop band.
729
730  Theory: |H(W)|^2 = 1/[1+(W/Wc)^(2N)] = 10^(-R/10)
731  With some algebra, you can solve simultaneously for Wc and N given
732  Ws,Rs and Wp,Rp.  For high pass filters, subtracting the band edges
733  from Fs/2, performing the test, and swapping the resulting Wc back
734  works beautifully.  For bandpass and bandstop filters this process
735  significantly overdesigns.  Artificially dividing N by 2 in this case
736  helps a lot, but it still overdesigns.
737
738  See also: butter
739
740
741
742 # name: <cell-element>
743 # type: sq_string
744 # elements: 1
745 # length: 80
746  Compute butterworth filter order and cutoff for the desired response
747  character
748
749
750
751 # name: <cell-element>
752 # type: sq_string
753 # elements: 1
754 # length: 5
755 cceps
756
757
758 # name: <cell-element>
759 # type: sq_string
760 # elements: 1
761 # length: 195
762  usage:  cceps (x [, correct])
763
764  Returns the complex cepstrum of the vector x.
765  If the optional argument correct has the value 1, a correction
766  method is applied.  The default is not to do this.
767
768
769
770 # name: <cell-element>
771 # type: sq_string
772 # elements: 1
773 # length: 31
774  usage:  cceps (x [, correct])
775
776
777
778
779 # name: <cell-element>
780 # type: sq_string
781 # elements: 1
782 # length: 4
783 cheb
784
785
786 # name: <cell-element>
787 # type: sq_string
788 # elements: 1
789 # length: 371
790  Usage:  cheb (n, x)
791
792  Returns the value of the nth-order Chebyshev polynomial calculated at
793  the point x. The Chebyshev polynomials are defined by the equations:
794
795            / cos(n acos(x),    |x| <= 1
796    Tn(x) = |
797            \ cosh(n acosh(x),  |x| > 1
798
799  If x is a vector, the output is a vector of the same size, where each
800  element is calculated as y(i) = Tn(x(i)).
801
802
803
804 # name: <cell-element>
805 # type: sq_string
806 # elements: 1
807 # length: 21
808  Usage:  cheb (n, x)
809
810
811
812
813 # name: <cell-element>
814 # type: sq_string
815 # elements: 1
816 # length: 8
817 cheb1ord
818
819
820 # name: <cell-element>
821 # type: sq_string
822 # elements: 1
823 # length: 678
824  Compute chebyshev type I filter order and cutoff for the desired response
825  characteristics. Rp is the allowable decibels of ripple in the pass 
826  band. Rs is the minimum attenuation in the stop band.
827
828  [n, Wc] = cheb1ord(Wp, Ws, Rp, Rs)
829      Low pass (Wp<Ws) or high pass (Wp>Ws) filter design.  Wp is the
830      pass band edge and Ws is the stop band edge.  Frequencies are
831      normalized to [0,1], corresponding to the range [0,Fs/2].
832  
833  [n, Wc] = cheb1ord([Wp1, Wp2], [Ws1, Ws2], Rp, Rs)
834      Band pass (Ws1<Wp1<Wp2<Ws2) or band reject (Wp1<Ws1<Ws2<Wp2)
835      filter design. Wp gives the edges of the pass band, and Ws gives
836      the edges of the stop band.
837
838  See also: cheby1
839
840
841
842 # name: <cell-element>
843 # type: sq_string
844 # elements: 1
845 # length: 80
846  Compute chebyshev type I filter order and cutoff for the desired response
847  char
848
849
850
851 # name: <cell-element>
852 # type: sq_string
853 # elements: 1
854 # length: 8
855 cheb2ord
856
857
858 # name: <cell-element>
859 # type: sq_string
860 # elements: 1
861 # length: 690
862  Compute chebyshev type II filter order and cutoff for the desired response
863  characteristics. Rp is the allowable decibels of ripple in the pass 
864  band. Rs is the minimum attenuation in the stop band.
865
866  [n, Wc] = cheb2ord(Wp, Ws, Rp, Rs)
867      Low pass (Wp<Ws) or high pass (Wp>Ws) filter design.  Wp is the
868      pass band edge and Ws is the stop band edge.  Frequencies are
869      normalized to [0,1], corresponding to the range [0,Fs/2].
870  
871  [n, Wc] = cheb2ord([Wp1, Wp2], [Ws1, Ws2], Rp, Rs)
872      Band pass (Ws1<Wp1<Wp2<Ws2) or band reject (Wp1<Ws1<Ws2<Wp2)
873      filter design. Wp gives the edges of the pass band, and Ws gives
874      the edges of the stop band.
875
876  Theory: 
877
878  See also: cheby2
879
880
881
882 # name: <cell-element>
883 # type: sq_string
884 # elements: 1
885 # length: 80
886  Compute chebyshev type II filter order and cutoff for the desired response
887  cha
888
889
890
891 # name: <cell-element>
892 # type: sq_string
893 # elements: 1
894 # length: 7
895 chebwin
896
897
898 # name: <cell-element>
899 # type: sq_string
900 # elements: 1
901 # length: 1095
902  Usage:  chebwin (L, at)
903
904  Returns the filter coefficients of the L-point Dolph-Chebyshev window
905  with at dB of attenuation in the stop-band of the corresponding
906  Fourier transform.
907
908  For the definition of the Chebyshev window, see
909
910  * Peter Lynch, "The Dolph-Chebyshev Window: A Simple Optimal Filter",
911    Monthly Weather Review, Vol. 125, pp. 655-660, April 1997.
912    (http://www.maths.tcd.ie/~plynch/Publications/Dolph.pdf)
913
914  * C. Dolph, "A current distribution for broadside arrays which
915    optimizes the relationship between beam width and side-lobe level",
916    Proc. IEEE, 34, pp. 335-348.
917
918  The window is described in frequency domain by the expression:
919
920           Cheb(L-1, beta * cos(pi * k/L))
921    W(k) = -------------------------------
922                  Cheb(L-1, beta)
923
924  with
925
926    beta = cosh(1/(L-1) * acosh(10^(at/20))
927
928  and Cheb(m,x) denoting the m-th order Chebyshev polynomial calculated
929  at the point x.
930
931  Note that the denominator in W(k) above is not computed, and after
932  the inverse Fourier transform the window is scaled by making its
933  maximum value unitary.
934
935  See also: kaiser
936
937
938
939 # name: <cell-element>
940 # type: sq_string
941 # elements: 1
942 # length: 25
943  Usage:  chebwin (L, at)
944
945
946
947
948 # name: <cell-element>
949 # type: sq_string
950 # elements: 1
951 # length: 6
952 cheby1
953
954
955 # name: <cell-element>
956 # type: sq_string
957 # elements: 1
958 # length: 802
959  Generate an Chebyshev type I filter with Rp dB of pass band ripple.
960  
961  [b, a] = cheby1(n, Rp, Wc)
962     low pass filter with cutoff pi*Wc radians
963
964  [b, a] = cheby1(n, Rp, Wc, 'high')
965     high pass filter with cutoff pi*Wc radians
966
967  [b, a] = cheby1(n, Rp, [Wl, Wh])
968     band pass filter with edges pi*Wl and pi*Wh radians
969
970  [b, a] = cheby1(n, Rp, [Wl, Wh], 'stop')
971     band reject filter with edges pi*Wl and pi*Wh radians
972
973  [z, p, g] = cheby1(...)
974     return filter as zero-pole-gain rather than coefficients of the
975     numerator and denominator polynomials.
976
977  [...] = cheby1(...,'s')
978      return a Laplace space filter, W can be larger than 1.
979  
980  [a,b,c,d] = cheby1(...)
981   return  state-space matrices 
982  
983  References: 
984
985  Parks & Burrus (1987). Digital Filter Design. New York:
986  John Wiley & Sons, Inc.
987
988
989
990 # name: <cell-element>
991 # type: sq_string
992 # elements: 1
993 # length: 68
994  Generate an Chebyshev type I filter with Rp dB of pass band ripple.
995
996
997
998 # name: <cell-element>
999 # type: sq_string
1000 # elements: 1
1001 # length: 6
1002 cheby2
1003
1004
1005 # name: <cell-element>
1006 # type: sq_string
1007 # elements: 1
1008 # length: 808
1009  Generate an Chebyshev type II filter with Rs dB of stop band attenuation.
1010  
1011  [b, a] = cheby2(n, Rs, Wc)
1012     low pass filter with cutoff pi*Wc radians
1013
1014  [b, a] = cheby2(n, Rs, Wc, 'high')
1015     high pass filter with cutoff pi*Wc radians
1016
1017  [b, a] = cheby2(n, Rs, [Wl, Wh])
1018     band pass filter with edges pi*Wl and pi*Wh radians
1019
1020  [b, a] = cheby2(n, Rs, [Wl, Wh], 'stop')
1021     band reject filter with edges pi*Wl and pi*Wh radians
1022
1023  [z, p, g] = cheby2(...)
1024     return filter as zero-pole-gain rather than coefficients of the
1025     numerator and denominator polynomials.
1026
1027  [...] = cheby2(...,'s')
1028      return a Laplace space filter, W can be larger than 1.
1029  
1030  [a,b,c,d] = cheby2(...)
1031   return  state-space matrices 
1032  
1033  References: 
1034
1035  Parks & Burrus (1987). Digital Filter Design. New York:
1036  John Wiley & Sons, Inc.
1037
1038
1039
1040 # name: <cell-element>
1041 # type: sq_string
1042 # elements: 1
1043 # length: 74
1044  Generate an Chebyshev type II filter with Rs dB of stop band attenuation.
1045
1046
1047
1048 # name: <cell-element>
1049 # type: sq_string
1050 # elements: 1
1051 # length: 5
1052 chirp
1053
1054
1055 # name: <cell-element>
1056 # type: sq_string
1057 # elements: 1
1058 # length: 811
1059  usage: y = chirp(t [, f0 [, t1 [, f1 [, form [, phase]]]]])
1060
1061  Evaluate a chirp signal at time t.  A chirp signal is a frequency
1062  swept cosine wave.
1063
1064  t: vector of times to evaluate the chirp signal
1065  f0: frequency at time t=0 [ 0 Hz ]
1066  t1: time t1 [ 1 sec ]
1067  f1: frequency at time t=t1 [ 100 Hz ]
1068  form: shape of frequency sweep
1069     'linear'      f(t) = (f1-f0)*(t/t1) + f0
1070     'quadratic'   f(t) = (f1-f0)*(t/t1)^2 + f0
1071     'logarithmic' f(t) = (f1-f0)^(t/t1) + f0
1072  phase: phase shift at t=0
1073
1074  Example
1075     specgram(chirp([0:0.001:5])); # linear, 0-100Hz in 1 sec
1076     specgram(chirp([-2:0.001:15], 400, 10, 100, 'quadratic'));
1077     soundsc(chirp([0:1/8000:5], 200, 2, 500, "logarithmic"),8000);
1078
1079  If you want a different sweep shape f(t), use the following:
1080     y = cos(2*pi*integral(f(t)) + 2*pi*f0*t + phase);
1081
1082
1083
1084 # name: <cell-element>
1085 # type: sq_string
1086 # elements: 1
1087 # length: 61
1088  usage: y = chirp(t [, f0 [, t1 [, f1 [, form [, phase]]]]])
1089
1090
1091
1092
1093 # name: <cell-element>
1094 # type: sq_string
1095 # elements: 1
1096 # length: 8
1097 cmorwavf
1098
1099
1100 # name: <cell-element>
1101 # type: sq_string
1102 # elements: 1
1103 # length: 96
1104  -- Function File: [PSI,X] = cmorwavf (LB,UB,N,FB,FC)
1105      Compute the Complex Morlet wavelet.
1106
1107
1108
1109
1110 # name: <cell-element>
1111 # type: sq_string
1112 # elements: 1
1113 # length: 35
1114 Compute the Complex Morlet wavelet.
1115
1116
1117
1118 # name: <cell-element>
1119 # type: sq_string
1120 # elements: 1
1121 # length: 6
1122 cohere
1123
1124
1125 # name: <cell-element>
1126 # type: sq_string
1127 # elements: 1
1128 # length: 377
1129  Usage:
1130    [Pxx,freq] = cohere(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
1131
1132      Estimate (mean square) coherence of signals "x" and "y".
1133      Use the Welch (1967) periodogram/FFT method.
1134      Compatible with Matlab R11 cohere and earlier.
1135      See "help pwelch" for description of arguments, hints and references
1136      --- especially hint (7) for Matlab R11 defaults.
1137
1138
1139
1140
1141 # name: <cell-element>
1142 # type: sq_string
1143 # elements: 1
1144 # length: 80
1145  Usage:
1146    [Pxx,freq] = cohere(x,y,Nfft,Fs,window,overlap,range,plot_type,detren
1147
1148
1149
1150 # name: <cell-element>
1151 # type: sq_string
1152 # elements: 1
1153 # length: 7
1154 convmtx
1155
1156
1157 # name: <cell-element>
1158 # type: sq_string
1159 # elements: 1
1160 # length: 498
1161  -- Function File:  convmtx (A, N)
1162      If A is a column vector and X is a column vector of length N, then
1163
1164      `convmtx(A, N) * X'
1165
1166      gives the convolution of of A and X and is the same as `conv(A,
1167      X)'. The difference is if many vectors are to be convolved with
1168      the same vector, then this technique is possibly faster.
1169
1170      Similarly, if A is a row vector and X is a row vector of length N,
1171      then
1172
1173      `X * convmtx(A, N)'
1174
1175      is the same as `conv(X, A)'.
1176
1177    See also: conv
1178
1179
1180
1181
1182 # name: <cell-element>
1183 # type: sq_string
1184 # elements: 1
1185 # length: 67
1186 If A is a column vector and X is a column vector of length N, then
1187
1188
1189
1190
1191 # name: <cell-element>
1192 # type: sq_string
1193 # elements: 1
1194 # length: 8
1195 cplxreal
1196
1197
1198 # name: <cell-element>
1199 # type: sq_string
1200 # elements: 1
1201 # length: 710
1202  -- Function File: [ZC, ZR] = cplxreal (Z, THRESH)
1203      Split the vector z into its complex (ZC) and real (ZR) elements,
1204      eliminating one of each complex-conjugate pair.
1205
1206      INPUTS:
1207         *   Z      = row- or column-vector of complex numbers
1208         *   THRESH = tolerance threshold for numerical comparisons
1209           (default = 100*eps)
1210
1211      RETURNED:
1212         * ZC = elements of Z having positive imaginary parts
1213         * ZR = elements of Z having zero imaginary part
1214
1215      Each complex element of Z is assumed to have a complex-conjugate
1216      counterpart elsewhere in Z as well.  Elements are declared real if
1217      their imaginary parts have magnitude less than THRESH.
1218
1219      See also: cplxpair
1220
1221
1222
1223
1224
1225 # name: <cell-element>
1226 # type: sq_string
1227 # elements: 1
1228 # length: 80
1229 Split the vector z into its complex (ZC) and real (ZR) elements,
1230 eliminating one
1231
1232
1233
1234 # name: <cell-element>
1235 # type: sq_string
1236 # elements: 1
1237 # length: 4
1238 cpsd
1239
1240
1241 # name: <cell-element>
1242 # type: sq_string
1243 # elements: 1
1244 # length: 260
1245  Usage:
1246    [Pxx,freq] = cpsd(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
1247
1248      Estimate cross power spectrum of data "x" and "y" by the Welch (1967)
1249      periodogram/FFT method.
1250      See "help pwelch" for description of arguments, hints and references
1251
1252
1253
1254 # name: <cell-element>
1255 # type: sq_string
1256 # elements: 1
1257 # length: 80
1258  Usage:
1259    [Pxx,freq] = cpsd(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
1260
1261
1262
1263 # name: <cell-element>
1264 # type: sq_string
1265 # elements: 1
1266 # length: 3
1267 csd
1268
1269
1270 # name: <cell-element>
1271 # type: sq_string
1272 # elements: 1
1273 # length: 358
1274  Usage:
1275    [Pxx,freq] = csd(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
1276
1277      Estimate cross power spectrum of data "x" and "y" by the Welch (1967)
1278      periodogram/FFT method.  Compatible with Matlab R11 csd and earlier.
1279      See "help pwelch" for description of arguments, hints and references
1280      --- especially hint (7) for Matlab R11 defaults.
1281
1282
1283
1284 # name: <cell-element>
1285 # type: sq_string
1286 # elements: 1
1287 # length: 80
1288  Usage:
1289    [Pxx,freq] = csd(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
1290
1291
1292
1293
1294 # name: <cell-element>
1295 # type: sq_string
1296 # elements: 1
1297 # length: 3
1298 czt
1299
1300
1301 # name: <cell-element>
1302 # type: sq_string
1303 # elements: 1
1304 # length: 828
1305  usage y=czt(x, m, w, a)
1306
1307  Chirp z-transform.  Compute the frequency response starting at a and
1308  stepping by w for m steps.  a is a point in the complex plane, and
1309  w is the ratio between points in each step (i.e., radius increases
1310  exponentially, and angle increases linearly).
1311
1312  To evaluate the frequency response for the range f1 to f2 in a signal
1313  with sampling frequency Fs, use the following:
1314      m = 32;                               ## number of points desired
1315      w = exp(-j*2*pi*(f2-f1)/((m-1)*Fs));  ## freq. step of f2-f1/m
1316      a = exp(j*2*pi*f1/Fs);                ## starting at frequency f1
1317      y = czt(x, m, w, a);
1318
1319  If you don't specify them, then the parameters default to a fourier 
1320  transform:
1321      m=length(x), w=exp(-j*2*pi/m), a=1
1322
1323  If x is a matrix, the transform will be performed column-by-column.
1324
1325
1326
1327 # name: <cell-element>
1328 # type: sq_string
1329 # elements: 1
1330 # length: 25
1331  usage y=czt(x, m, w, a)
1332
1333
1334
1335
1336 # name: <cell-element>
1337 # type: sq_string
1338 # elements: 1
1339 # length: 8
1340 data2fun
1341
1342
1343 # name: <cell-element>
1344 # type: sq_string
1345 # elements: 1
1346 # length: 1111
1347  -- Function File: [FHANDLE, FULLNAME] =  data2fun (TI, YI)
1348  -- Function File: [ ... ] =  data2fun (TI, YI,PROPERTY,VALUE)
1349      Creates a vectorized function based on data samples using
1350      interpolation.
1351
1352      The values given in YI (N-by-k matrix) correspond to evaluations
1353      of the function y(t) at the points TI (N-by-1 matrix).  The data
1354      is interpolated and the function handle to the generated
1355      interpolant is returned.
1356
1357      The function accepts property-value pairs described below.
1358
1359     `file'
1360           Code is generated and .m file is created. The VALUE contains
1361           the name of the function. The returned function handle is a
1362           handle to that file. If VALUE is empty, then a name is
1363           automatically generated using `tmpnam' and the file is
1364           created in the current directory. VALUE must not have an
1365           extension, since .m will be appended.  Numerical value used
1366           in the function are stored in a .mat file with the same name
1367           as the function.
1368
1369     `interp'
1370           Type of interpolation. See `interp1'.
1371
1372
1373      See also: interp1
1374
1375
1376
1377
1378
1379 # name: <cell-element>
1380 # type: sq_string
1381 # elements: 1
1382 # length: 72
1383 Creates a vectorized function based on data samples using interpolation.
1384
1385
1386
1387 # name: <cell-element>
1388 # type: sq_string
1389 # elements: 1
1390 # length: 3
1391 dct
1392
1393
1394 # name: <cell-element>
1395 # type: sq_string
1396 # elements: 1
1397 # length: 687
1398  y = dct (x, n)
1399     Computes the discrete cosine transform of x.  If n is given, then
1400     x is padded or trimmed to length n before computing the transform.
1401     If x is a matrix, compute the transform along the columns of the
1402     the matrix. The transform is faster if x is real-valued and even
1403     length.
1404
1405  The discrete cosine transform X of x can be defined as follows:
1406
1407                N-1
1408    X[k] = w(k) sum x[n] cos (pi (2n+1) k / 2N ),  k = 0, ..., N-1
1409                n=0
1410
1411  with w(0) = sqrt(1/N) and w(k) = sqrt(2/N), k = 1, ..., N-1.  There
1412  are other definitions with different scaling of X[k], but this form
1413  is common in image processing.
1414
1415  See also: idct, dct2, idct2, dctmtx
1416
1417
1418
1419 # name: <cell-element>
1420 # type: sq_string
1421 # elements: 1
1422 # length: 64
1423  y = dct (x, n)
1424     Computes the discrete cosine transform of x.
1425
1426
1427
1428 # name: <cell-element>
1429 # type: sq_string
1430 # elements: 1
1431 # length: 4
1432 dct2
1433
1434
1435 # name: <cell-element>
1436 # type: sq_string
1437 # elements: 1
1438 # length: 202
1439  y = dct2 (x)
1440    Computes the 2-D discrete cosine transform of matrix x
1441
1442  y = dct2 (x, m, n) or y = dct2 (x, [m n])
1443    Computes the 2-D DCT of x after padding or trimming rows to m and
1444    columns to n.
1445
1446
1447
1448 # name: <cell-element>
1449 # type: sq_string
1450 # elements: 1
1451 # length: 72
1452  y = dct2 (x)
1453    Computes the 2-D discrete cosine transform of matrix x
1454
1455
1456
1457
1458 # name: <cell-element>
1459 # type: sq_string
1460 # elements: 1
1461 # length: 6
1462 dctmtx
1463
1464
1465 # name: <cell-element>
1466 # type: sq_string
1467 # elements: 1
1468 # length: 599
1469  T = dctmtx (n)
1470  Return the DCT transformation matrix of size n x n.
1471
1472  If A is an n x n matrix, then the following are true:
1473      T*A    == dct(A),  T'*A   == idct(A)
1474      T*A*T' == dct2(A), T'*A*T == idct2(A)
1475
1476  A dct transformation matrix is useful for doing things like jpeg
1477  image compression, in which an 8x8 dct matrix is applied to
1478  non-overlapping blocks throughout an image and only a subblock on the
1479  top left of each block is kept.  During restoration, the remainder of
1480  the block is filled with zeros and the inverse transform is applied
1481  to the block.
1482
1483  See also: dct, idct, dct2, idct2
1484
1485
1486
1487 # name: <cell-element>
1488 # type: sq_string
1489 # elements: 1
1490 # length: 68
1491  T = dctmtx (n)
1492  Return the DCT transformation matrix of size n x n.
1493
1494
1495
1496 # name: <cell-element>
1497 # type: sq_string
1498 # elements: 1
1499 # length: 8
1500 decimate
1501
1502
1503 # name: <cell-element>
1504 # type: sq_string
1505 # elements: 1
1506 # length: 1021
1507  usage: y = decimate(x, q [, n] [, ftype])
1508
1509  Downsample the signal x by a factor of q, using an order n filter
1510  of ftype 'fir' or 'iir'.  By default, an order 8 Chebyshev type I
1511  filter is used or a 30 point FIR filter if ftype is 'fir'.  Note
1512  that q must be an integer for this rate change method.
1513
1514  Example
1515     ## Generate a signal that starts away from zero, is slowly varying
1516     ## at the start and quickly varying at the end, decimate and plot.
1517     ## Since it starts away from zero, you will see the boundary
1518     ## effects of the antialiasing filter clearly.  Next you will see
1519     ## how it follows the curve nicely in the slowly varying early
1520     ## part of the signal, but averages the curve in the quickly
1521     ## varying late part of the signal.
1522     t=0:0.01:2; x=chirp(t,2,.5,10,'quadratic')+sin(2*pi*t*0.4); 
1523     y = decimate(x,4);   # factor of 4 decimation
1524     stem(t(1:121)*1000,x(1:121),"-g;Original;"); hold on; # plot original
1525     stem(t(1:4:121)*1000,y(1:31),"-r;Decimated;"); hold off; # decimated
1526
1527
1528
1529 # name: <cell-element>
1530 # type: sq_string
1531 # elements: 1
1532 # length: 43
1533  usage: y = decimate(x, q [, n] [, ftype])
1534
1535
1536
1537
1538 # name: <cell-element>
1539 # type: sq_string
1540 # elements: 1
1541 # length: 6
1542 dftmtx
1543
1544
1545 # name: <cell-element>
1546 # type: sq_string
1547 # elements: 1
1548 # length: 343
1549  -- Function File: D =  dftmtx (N)
1550      If N is a scalar, produces a N-by-N matrix D such that the Fourier
1551      transform of a column vector of length N is given by `dftmtx(N) *
1552      x' and the inverse Fourier transform is given by `inv(dftmtx(N)) *
1553      x'. In general this is less efficient than calling the "fft" and
1554      "ifft" directly.
1555
1556
1557
1558
1559 # name: <cell-element>
1560 # type: sq_string
1561 # elements: 1
1562 # length: 80
1563 If N is a scalar, produces a N-by-N matrix D such that the Fourier
1564 transform of 
1565
1566
1567
1568 # name: <cell-element>
1569 # type: sq_string
1570 # elements: 1
1571 # length: 5
1572 diric
1573
1574
1575 # name: <cell-element>
1576 # type: sq_string
1577 # elements: 1
1578 # length: 116
1579  -- Function File: [Y] = diric(X,N)
1580      Compute the dirichlet function.
1581
1582      See also: sinc, gauspuls, sawtooth
1583
1584
1585
1586
1587
1588 # name: <cell-element>
1589 # type: sq_string
1590 # elements: 1
1591 # length: 31
1592 Compute the dirichlet function.
1593
1594
1595
1596 # name: <cell-element>
1597 # type: sq_string
1598 # elements: 1
1599 # length: 10
1600 downsample
1601
1602
1603 # name: <cell-element>
1604 # type: sq_string
1605 # elements: 1
1606 # length: 511
1607  -- Function File: Y = downsample (X, N)
1608  -- Function File: Y = downsample (X, N, OFFSET)
1609      Downsample the signal, selecting every nth element.  If X is a
1610      matrix, downsample every column.
1611
1612      For most signals you will want to use `decimate' instead since it
1613      prefilters the high frequency components of the signal and avoids
1614      aliasing effects.
1615
1616      If OFFSET is defined, select every nth element starting at sample
1617      OFFSET.
1618
1619      See also: decimate, interp, resample, upfirdn, upsample
1620
1621
1622
1623
1624
1625 # name: <cell-element>
1626 # type: sq_string
1627 # elements: 1
1628 # length: 51
1629 Downsample the signal, selecting every nth element.
1630
1631
1632
1633 # name: <cell-element>
1634 # type: sq_string
1635 # elements: 1
1636 # length: 3
1637 dst
1638
1639
1640 # name: <cell-element>
1641 # type: sq_string
1642 # elements: 1
1643 # length: 482
1644  -- Function File: Y = dst (X)
1645  -- Function File: Y = dst (X, N)
1646      Computes the type I discrete sine transform of X.  If N is given,
1647      then X is padded or trimmed to length N before computing the
1648      transform.  If X is a matrix, compute the transform along the
1649      columns of the the matrix.
1650
1651      The discrete sine transform X of x can be defined as follows:
1652
1653             N
1654      X[k] = sum x[n] sin (pi n k / (N+1) ),  k = 1, ..., N
1655             n=1
1656
1657      See also: idst
1658
1659
1660
1661
1662
1663 # name: <cell-element>
1664 # type: sq_string
1665 # elements: 1
1666 # length: 49
1667 Computes the type I discrete sine transform of X.
1668
1669
1670
1671 # name: <cell-element>
1672 # type: sq_string
1673 # elements: 1
1674 # length: 3
1675 dwt
1676
1677
1678 # name: <cell-element>
1679 # type: sq_string
1680 # elements: 1
1681 # length: 111
1682  -- Function File: [CA CD] = dwt(X,LO_D,HI_D)
1683      Comupte de discrete wavelet transform of x with one level.
1684
1685
1686
1687
1688 # name: <cell-element>
1689 # type: sq_string
1690 # elements: 1
1691 # length: 58
1692 Comupte de discrete wavelet transform of x with one level.
1693
1694
1695
1696 # name: <cell-element>
1697 # type: sq_string
1698 # elements: 1
1699 # length: 5
1700 ellip
1701
1702
1703 # name: <cell-element>
1704 # type: sq_string
1705 # elements: 1
1706 # length: 1050
1707  N-ellip 0.2.1
1708 usage: [Zz, Zp, Zg] = ellip(n, Rp, Rs, Wp, stype,'s')
1709
1710  Generate an Elliptic or Cauer filter (discrete and contnuious).
1711  
1712  [b,a] = ellip(n, Rp, Rs, Wp)
1713   low pass filter with order n, cutoff pi*Wp radians, Rp decibels 
1714   of ripple in the passband and a stopband Rs decibels down.
1715
1716  [b,a] = ellip(n, Rp, Rs, Wp, 'high')
1717   high pass filter with cutoff pi*Wp...
1718
1719  [b,a] = ellip(n, Rp, Rs, [Wl, Wh])
1720   band pass filter with band pass edges pi*Wl and pi*Wh ...
1721
1722  [b,a] = ellip(n, Rp, Rs, [Wl, Wh], 'stop')
1723   band reject filter with edges pi*Wl and pi*Wh, ...
1724
1725  [z,p,g] = ellip(...)
1726   return filter as zero-pole-gain.
1727
1728  [...] = ellip(...,'s')
1729      return a Laplace space filter, W can be larger than 1.
1730  
1731  [a,b,c,d] = ellip(...)
1732   return  state-space matrices 
1733
1734  References: 
1735
1736  - Oppenheim, Alan V., Discrete Time Signal Processing, Hardcover, 1999.
1737  - Parente Ribeiro, E., Notas de aula da disciplina TE498 -  Processamento 
1738    Digital de Sinais, UFPR, 2001/2002.
1739  - Kienzle, Paul, functions from Octave-Forge, 1999 (http://octave.sf.net).
1740
1741
1742
1743 # name: <cell-element>
1744 # type: sq_string
1745 # elements: 1
1746 # length: 11
1747  N-ellip 0.
1748
1749
1750
1751 # name: <cell-element>
1752 # type: sq_string
1753 # elements: 1
1754 # length: 8
1755 ellipord
1756
1757
1758 # name: <cell-element>
1759 # type: sq_string
1760 # elements: 1
1761 # length: 346
1762  usage: [n,wp] = ellipord(wp,ws, rp,rs)
1763
1764  Calculate the order for the elliptic filter (discrete)
1765  wp: Cutoff frequency
1766  ws: Stopband edge
1767  rp: decibels of ripple in the passband.
1768  rs: decibels of ripple in the stopband.
1769
1770  References: 
1771
1772  - Lamar, Marcus Vinicius, Notas de aula da disciplina TE 456 - Circuitos 
1773    Analogicos II, UFPR, 2001/2002.
1774
1775
1776
1777 # name: <cell-element>
1778 # type: sq_string
1779 # elements: 1
1780 # length: 40
1781  usage: [n,wp] = ellipord(wp,ws, rp,rs)
1782
1783
1784
1785
1786 # name: <cell-element>
1787 # type: sq_string
1788 # elements: 1
1789 # length: 3
1790 fht
1791
1792
1793 # name: <cell-element>
1794 # type: sq_string
1795 # elements: 1
1796 # length: 788
1797  -- Function File: m =  fht ( d, n, dim )
1798      The function fht calculates  Fast Hartley Transform  where D is
1799      the real input vector (matrix), and M is the real-transform
1800      vector. For matrices the hartley transform is calculated along the
1801      columns by default. The options N,and DIM are similar to the
1802      options of FFT function.
1803
1804      The forward and inverse hartley transforms are the same (except
1805      for a scale factor of 1/N for the inverse hartley transform), but
1806      implemented using different functions .
1807
1808      The definition of the forward hartley transform for vector d,
1809
1810      m[K] = \sum_i=0^N-1 d[i]*(cos[K*2*pi*i/N] + sin[K*2*pi*i/N]), for
1811      0 <= K < N.  m[K] = \sum_i=0^N-1 d[i]*CAS[K*i], for  0 <= K < N.
1812
1813           fht(1:4)
1814
1815      See also: ifht, fft
1816
1817
1818
1819
1820
1821 # name: <cell-element>
1822 # type: sq_string
1823 # elements: 1
1824 # length: 80
1825 The function fht calculates  Fast Hartley Transform  where D is the
1826 real input v
1827
1828
1829
1830 # name: <cell-element>
1831 # type: sq_string
1832 # elements: 1
1833 # length: 8
1834 filtfilt
1835
1836
1837 # name: <cell-element>
1838 # type: sq_string
1839 # elements: 1
1840 # length: 673
1841  usage: y = filtfilt(b, a, x)
1842
1843  Forward and reverse filter the signal. This corrects for phase
1844  distortion introduced by a one-pass filter, though it does square the
1845  magnitude response in the process. That's the theory at least.  In
1846  practice the phase correction is not perfect, and magnitude response
1847  is distorted, particularly in the stop band.
1848
1849  Example
1850     [b, a]=butter(3, 0.1);                   % 10 Hz low-pass filter
1851     t = 0:0.01:1.0;                         % 1 second sample
1852     x=sin(2*pi*t*2.3)+0.25*randn(size(t));  % 2.3 Hz sinusoid+noise
1853     y = filtfilt(b,a,x); z = filter(b,a,x); % apply filter
1854     plot(t,x,';data;',t,y,';filtfilt;',t,z,';filter;')
1855
1856
1857
1858 # name: <cell-element>
1859 # type: sq_string
1860 # elements: 1
1861 # length: 30
1862  usage: y = filtfilt(b, a, x)
1863
1864
1865
1866
1867 # name: <cell-element>
1868 # type: sq_string
1869 # elements: 1
1870 # length: 6
1871 filtic
1872
1873
1874 # name: <cell-element>
1875 # type: sq_string
1876 # elements: 1
1877 # length: 718
1878  Set initial condition vector for filter function
1879  The vector zf has the same values that would be obtained 
1880  from function filter given past inputs x and outputs y
1881
1882  The vectors x and y contain the most recent inputs and outputs
1883  respectively, with the newest values first:
1884
1885  x = [x(-1) x(-2) ... x(-nb)], nb = length(b)-1
1886  y = [y(-1) y(-2) ... y(-na)], na = length(a)-a
1887
1888  If length(x)<nb then it is zero padded
1889  If length(y)<na then it is zero padded
1890
1891  zf = filtic(b, a, y)
1892     Initial conditions for filter with coefficients a and b
1893     and output vector y, assuming input vector x is zero
1894
1895  zf = filtic(b, a, y, x)
1896     Initial conditions for filter with coefficients a and b
1897     input vector x and output vector y
1898
1899
1900
1901 # name: <cell-element>
1902 # type: sq_string
1903 # elements: 1
1904 # length: 80
1905  Set initial condition vector for filter function
1906  The vector zf has the same va
1907
1908
1909
1910 # name: <cell-element>
1911 # type: sq_string
1912 # elements: 1
1913 # length: 4
1914 fir1
1915
1916
1917 # name: <cell-element>
1918 # type: sq_string
1919 # elements: 1
1920 # length: 1180
1921  usage: b = fir1(n, w [, type] [, window] [, noscale])
1922
1923  Produce an order n FIR filter with the given frequency cutoff,
1924  returning the n+1 filter coefficients in b.  
1925
1926  n: order of the filter (1 less than the length of the filter)
1927  w: band edges
1928     strictly increasing vector in range [0, 1]
1929     singleton for highpass or lowpass, vector pair for bandpass or
1930     bandstop, or vector for alternating pass/stop filter.
1931  type: choose between pass and stop bands
1932     'high' for highpass filter, cutoff at w
1933     'stop' for bandstop filter, edges at w = [lo, hi]
1934     'DC-0' for bandstop as first band of multiband filter
1935     'DC-1' for bandpass as first band of multiband filter
1936  window: smoothing window
1937     defaults to hamming(n+1) row vector
1938     returned filter is the same shape as the smoothing window
1939  noscale: choose whether to normalize or not
1940     'scale': set the magnitude of the center of the first passband to 1
1941     'noscale': don't normalize
1942
1943  To apply the filter, use the return vector b:
1944        y=filter(b,1,x);
1945
1946  Examples:
1947    freqz(fir1(40,0.3));
1948    freqz(fir1(15,[0.2, 0.5], 'stop'));  # note the zero-crossing at 0.1
1949    freqz(fir1(15,[0.2, 0.5], 'stop', 'noscale'));
1950
1951
1952
1953 # name: <cell-element>
1954 # type: sq_string
1955 # elements: 1
1956 # length: 55
1957  usage: b = fir1(n, w [, type] [, window] [, noscale])
1958
1959
1960
1961
1962 # name: <cell-element>
1963 # type: sq_string
1964 # elements: 1
1965 # length: 4
1966 fir2
1967
1968
1969 # name: <cell-element>
1970 # type: sq_string
1971 # elements: 1
1972 # length: 1197
1973  usage: b = fir2(n, f, m [, grid_n [, ramp_n]] [, window])
1974
1975  Produce an FIR filter of order n with arbitrary frequency response,
1976  returning the n+1 filter coefficients in b.
1977
1978  n: order of the filter (1 less than the length of the filter)
1979  f: frequency at band edges
1980     f is a vector of nondecreasing elements in [0,1]
1981     the first element must be 0 and the last element must be 1
1982     if elements are identical, it indicates a jump in freq. response
1983  m: magnitude at band edges
1984     m is a vector of length(f)
1985  grid_n: length of ideal frequency response function
1986     defaults to 512, should be a power of 2 bigger than n
1987  ramp_n: transition width for jumps in filter response
1988     defaults to grid_n/20; a wider ramp gives wider transitions
1989     but has better stopband characteristics.
1990  window: smoothing window
1991     defaults to hamming(n+1) row vector
1992     returned filter is the same shape as the smoothing window
1993
1994  To apply the filter, use the return vector b:
1995        y=filter(b,1,x);
1996  Note that plot(f,m) shows target response.
1997
1998  Example:
1999    f=[0, 0.3, 0.3, 0.6, 0.6, 1]; m=[0, 0, 1, 1/2, 0, 0];
2000    [h, w] = freqz(fir2(100,f,m));
2001    plot(f,m,';target response;',w/pi,abs(h),';filter response;');
2002
2003
2004
2005 # name: <cell-element>
2006 # type: sq_string
2007 # elements: 1
2008 # length: 59
2009  usage: b = fir2(n, f, m [, grid_n [, ramp_n]] [, window])
2010
2011
2012
2013
2014 # name: <cell-element>
2015 # type: sq_string
2016 # elements: 1
2017 # length: 5
2018 firls
2019
2020
2021 # name: <cell-element>
2022 # type: sq_string
2023 # elements: 1
2024 # length: 908
2025  b = firls(N, F, A);
2026  b = firls(N, F, A, W);
2027
2028   FIR filter design using least squares method. Returns a length N+1
2029   linear phase filter such that the integral of the weighted mean
2030   squared error in the specified bands is minimized.
2031
2032   F specifies the frequencies of the band edges, normalized so that
2033   half the sample frequency is equal to 1.  Each band is specified by
2034   two frequencies, to the vector must have an even length.
2035
2036   A specifies the amplitude of the desired response at each band edge.
2037
2038   W is an optional weighting function that contains one value for each
2039   band that weights the mean squared error in that band. A must be the
2040   same length as F, and W must be half the length of F.
2041
2042  The least squares optimization algorithm for computing FIR filter
2043  coefficients is derived in detail in:
2044
2045  I. Selesnick, "Linear-Phase FIR Filter Design by Least Squares,"
2046  http://cnx.org/content/m10577
2047
2048
2049
2050 # name: <cell-element>
2051 # type: sq_string
2052 # elements: 1
2053 # length: 45
2054  b = firls(N, F, A);
2055  b = firls(N, F, A, W);
2056
2057
2058
2059
2060 # name: <cell-element>
2061 # type: sq_string
2062 # elements: 1
2063 # length: 10
2064 flattopwin
2065
2066
2067 # name: <cell-element>
2068 # type: sq_string
2069 # elements: 1
2070 # length: 679
2071  flattopwin(L, [periodic|symmetric])
2072
2073  Return the window f(w):
2074
2075    f(w) = 1 - 1.93 cos(2 pi w) + 1.29 cos(4 pi w)
2076             - 0.388 cos(6 pi w) + 0.0322cos(8 pi w)
2077
2078  where w = i/(L-1) for i=0:L-1 for a symmetric window, or
2079  w = i/L for i=0:L-1 for a periodic window.  The default
2080  is symmetric.  The returned window is normalized to a peak
2081  of 1 at w = 0.5.
2082
2083  This window has low pass-band ripple, but high bandwidth.
2084
2085  According to [1]:
2086
2087     The main use for the Flat Top window is for calibration, due
2088     to its negligible amplitude errors.
2089
2090  [1] Gade, S; Herlufsen, H; (1987) "Use of weighting functions in DFT/FFT
2091  analysis (Part I)", Bruel & Kjaer Technical Review No.3.
2092
2093
2094
2095 # name: <cell-element>
2096 # type: sq_string
2097 # elements: 1
2098 # length: 37
2099  flattopwin(L, [periodic|symmetric])
2100
2101
2102
2103
2104 # name: <cell-element>
2105 # type: sq_string
2106 # elements: 1
2107 # length: 9
2108 fracshift
2109
2110
2111 # name: <cell-element>
2112 # type: sq_string
2113 # elements: 1
2114 # length: 279
2115  -- Function File: [Y H]= fracshift(X,D)
2116  -- Function File: Y = fracshift(X,D,H)
2117      Shift the series X by a (possibly fractional) number of samples D.
2118      The interpolator H is either specified or either designed with a
2119      Kaiser-windowed sinecard.
2120
2121    See also: circshift
2122
2123
2124
2125
2126 # name: <cell-element>
2127 # type: sq_string
2128 # elements: 1
2129 # length: 66
2130 Shift the series X by a (possibly fractional) number of samples D.
2131
2132
2133
2134 # name: <cell-element>
2135 # type: sq_string
2136 # elements: 1
2137 # length: 5
2138 freqs
2139
2140
2141 # name: <cell-element>
2142 # type: sq_string
2143 # elements: 1
2144 # length: 300
2145  Usage: H = freqs(B,A,W);
2146
2147  Compute the s-plane frequency response of the IIR filter B(s)/A(s) as 
2148  H = polyval(B,j*W)./polyval(A,j*W).  If called with no output
2149  argument, a plot of magnitude and phase are displayed.
2150
2151  Example:
2152     B = [1 2]; A = [1 1];
2153     w = linspace(0,4,128);
2154     freqs(B,A,w);
2155
2156
2157
2158 # name: <cell-element>
2159 # type: sq_string
2160 # elements: 1
2161 # length: 26
2162  Usage: H = freqs(B,A,W);
2163
2164
2165
2166
2167 # name: <cell-element>
2168 # type: sq_string
2169 # elements: 1
2170 # length: 10
2171 freqs_plot
2172
2173
2174 # name: <cell-element>
2175 # type: sq_string
2176 # elements: 1
2177 # length: 90
2178  -- Function File: freqs_plot (W, H)
2179      Plot the amplitude and phase of the vector H.
2180
2181
2182
2183
2184
2185 # name: <cell-element>
2186 # type: sq_string
2187 # elements: 1
2188 # length: 45
2189 Plot the amplitude and phase of the vector H.
2190
2191
2192
2193 # name: <cell-element>
2194 # type: sq_string
2195 # elements: 1
2196 # length: 4
2197 fwhm
2198
2199
2200 # name: <cell-element>
2201 # type: sq_string
2202 # elements: 1
2203 # length: 1318
2204  Compute peak full-width at half maximum (FWHM) or at another level of peak
2205  maximum for vector or matrix data y, optionally sampled as y(x). If y is
2206  a matrix, return FWHM for each column as a row vector.
2207    Syntax:
2208       f = fwhm({x, } y {, 'zero'|'min' {, 'rlevel', rlevel}})
2209       f = fwhm({x, } y {, 'alevel', alevel})
2210    Examples:
2211       f = fwhm(y)
2212       f = fwhm(x, y)
2213       f = fwhm(x, y, 'zero')
2214       f = fwhm(x, y, 'min')
2215       f = fwhm(x, y, 'alevel', 15.3)
2216       f = fwhm(x, y, 'zero', 'rlevel', 0.5)
2217       f = fwhm(x, y, 'min',  'rlevel', 0.1)
2218
2219  The default option 'zero' computes fwhm at half maximum, i.e. 0.5*max(y).
2220  The option 'min' computes fwhm at the middle curve, i.e. 0.5*(min(y)+max(y)).
2221
2222  The option 'rlevel' computes full-width at the given relative level of peak
2223  profile, i.e. at rlevel*max(y) or rlevel*(min(y)+max(y)), respectively.
2224  For example, fwhm(..., 'rlevel', 0.1) computes full width at 10 % of peak
2225  maximum with respect to zero or minimum; FWHM is equivalent to
2226  fwhm(..., 'rlevel', 0.5).
2227
2228  The option 'alevel' computes full-width at the given absolute level of y.
2229
2230  Return 0 if FWHM does not exist (e.g. monotonous function or the function
2231  does not cut horizontal line at rlevel*max(y) or rlevel*(max(y)+min(y)) or
2232  alevel, respectively).
2233
2234  Compatibility: Octave 3.x, Matlab
2235
2236
2237
2238 # name: <cell-element>
2239 # type: sq_string
2240 # elements: 1
2241 # length: 80
2242  Compute peak full-width at half maximum (FWHM) or at another level of peak
2243  max
2244
2245
2246
2247 # name: <cell-element>
2248 # type: sq_string
2249 # elements: 1
2250 # length: 8
2251 gauspuls
2252
2253
2254 # name: <cell-element>
2255 # type: sq_string
2256 # elements: 1
2257 # length: 97
2258  -- Function File: [Y] = gauspuls(T,FC,BW)
2259      Return the Gaussian modulated sinusoidal pulse.
2260
2261
2262
2263
2264 # name: <cell-element>
2265 # type: sq_string
2266 # elements: 1
2267 # length: 47
2268 Return the Gaussian modulated sinusoidal pulse.
2269
2270
2271
2272 # name: <cell-element>
2273 # type: sq_string
2274 # elements: 1
2275 # length: 8
2276 gaussian
2277
2278
2279 # name: <cell-element>
2280 # type: sq_string
2281 # elements: 1
2282 # length: 442
2283  usage: w = gaussian(n, a)
2284
2285  Generate an n-point gaussian convolution window of the given
2286  width.  Use larger a for a narrower window.  Use larger n for
2287  longer tails.
2288
2289      w = exp ( -(a*x)^2/2 )
2290
2291  for x = linspace ( -(n-1)/2, (n-1)/2, n ).
2292
2293  Width a is measured in frequency units (sample rate/num samples). 
2294  It should be f when multiplying in the time domain, but 1/f when 
2295  multiplying in the frequency domain (for use in convolutions).
2296
2297
2298
2299 # name: <cell-element>
2300 # type: sq_string
2301 # elements: 1
2302 # length: 27
2303  usage: w = gaussian(n, a)
2304
2305
2306
2307
2308 # name: <cell-element>
2309 # type: sq_string
2310 # elements: 1
2311 # length: 8
2312 gausswin
2313
2314
2315 # name: <cell-element>
2316 # type: sq_string
2317 # elements: 1
2318 # length: 227
2319  usage: w = gausswin(L, a)
2320
2321  Generate an L-point gaussian window of the given width. Use larger a
2322  for a narrow window.  Use larger L for a smoother curve. 
2323
2324      w = exp ( -(a*x)^2/2 )
2325
2326  for x = linspace(-(L-1)/L, (L-1)/L, L)
2327
2328
2329
2330 # name: <cell-element>
2331 # type: sq_string
2332 # elements: 1
2333 # length: 27
2334  usage: w = gausswin(L, a)
2335
2336
2337
2338
2339 # name: <cell-element>
2340 # type: sq_string
2341 # elements: 1
2342 # length: 9
2343 gmonopuls
2344
2345
2346 # name: <cell-element>
2347 # type: sq_string
2348 # elements: 1
2349 # length: 78
2350  -- Function File: [Y] = gmonopuls(T,FC)
2351      Return the gaussian monopulse.
2352
2353
2354
2355
2356 # name: <cell-element>
2357 # type: sq_string
2358 # elements: 1
2359 # length: 30
2360 Return the gaussian monopulse.
2361
2362
2363
2364 # name: <cell-element>
2365 # type: sq_string
2366 # elements: 1
2367 # length: 8
2368 grpdelay
2369
2370
2371 # name: <cell-element>
2372 # type: sq_string
2373 # elements: 1
2374 # length: 2463
2375  Compute the group delay of a filter.
2376
2377  [g, w] = grpdelay(b)
2378    returns the group delay g of the FIR filter with coefficients b.
2379    The response is evaluated at 512 angular frequencies between 0 and
2380    pi. w is a vector containing the 512 frequencies.
2381    The group delay is in units of samples.  It can be converted
2382    to seconds by multiplying by the sampling period (or dividing by
2383    the sampling rate fs).
2384
2385  [g, w] = grpdelay(b,a)
2386    returns the group delay of the rational IIR filter whose numerator
2387    has coefficients b and denominator coefficients a.
2388
2389  [g, w] = grpdelay(b,a,n)
2390    returns the group delay evaluated at n angular frequencies.  For fastest
2391    computation n should factor into a small number of small primes.
2392
2393  [g, w] = grpdelay(b,a,n,'whole')
2394    evaluates the group delay at n frequencies between 0 and 2*pi.
2395
2396  [g, f] = grpdelay(b,a,n,Fs)
2397    evaluates the group delay at n frequencies between 0 and Fs/2.
2398
2399  [g, f] = grpdelay(b,a,n,'whole',Fs)
2400    evaluates the group delay at n frequencies between 0 and Fs.
2401
2402  [g, w] = grpdelay(b,a,w)
2403    evaluates the group delay at frequencies w (radians per sample).
2404
2405  [g, f] = grpdelay(b,a,f,Fs)
2406    evaluates the group delay at frequencies f (in Hz).
2407
2408  grpdelay(...)
2409    plots the group delay vs. frequency.
2410
2411  If the denominator of the computation becomes too small, the group delay
2412  is set to zero.  (The group delay approaches infinity when
2413  there are poles or zeros very close to the unit circle in the z plane.)
2414
2415  Theory: group delay, g(w) = -d/dw [arg{H(e^jw)}],  is the rate of change of
2416  phase with respect to frequency.  It can be computed as:
2417
2418                d/dw H(e^-jw)
2419         g(w) = -------------
2420                  H(e^-jw)
2421
2422  where
2423          H(z) = B(z)/A(z) = sum(b_k z^k)/sum(a_k z^k).
2424
2425  By the quotient rule,
2426                     A(z) d/dw B(z) - B(z) d/dw A(z)
2427         d/dw H(z) = -------------------------------
2428                                A(z) A(z)
2429  Substituting into the expression above yields:
2430                 A dB - B dA
2431         g(w) =  ----------- = dB/B - dA/A
2432                     A B
2433
2434  Note that,
2435         d/dw B(e^-jw) = sum(k b_k e^-jwk)
2436         d/dw A(e^-jw) = sum(k a_k e^-jwk)
2437  which is just the FFT of the coefficients multiplied by a ramp.
2438
2439  As a further optimization when nfft>>length(a), the IIR filter (b,a)
2440  is converted to the FIR filter conv(b,fliplr(conj(a))).
2441  For further details, see
2442  http://ccrma.stanford.edu/~jos/filters/Numerical_Computation_Group_Delay.html
2443
2444
2445
2446 # name: <cell-element>
2447 # type: sq_string
2448 # elements: 1
2449 # length: 37
2450  Compute the group delay of a filter.
2451
2452
2453
2454 # name: <cell-element>
2455 # type: sq_string
2456 # elements: 1
2457 # length: 4
2458 hann
2459
2460
2461 # name: <cell-element>
2462 # type: sq_string
2463 # elements: 1
2464 # length: 28
2465  w = hann(n)
2466    see hanning
2467
2468
2469
2470 # name: <cell-element>
2471 # type: sq_string
2472 # elements: 1
2473 # length: 28
2474  w = hann(n)
2475    see hanning
2476
2477
2478
2479
2480 # name: <cell-element>
2481 # type: sq_string
2482 # elements: 1
2483 # length: 7
2484 hilbert
2485
2486
2487 # name: <cell-element>
2488 # type: sq_string
2489 # elements: 1
2490 # length: 647
2491  -- Function File: H = hilbert (F,N,DIM)
2492      Analytic extension of real valued signal
2493
2494      `H=hilbert(F)' computes the extension of the real valued signal F
2495      to an analytic signal. If F is a matrix, the transformation is
2496      applied to each column. For N-D arrays, the transformation is
2497      applied to the first non-singleton dimension.
2498
2499      `real(H)' contains the original signal F.  `imag(H)' contains the
2500      Hilbert transform of F.
2501
2502      `hilbert(F,N)' does the same using a length N Hilbert transform.
2503      The result will also have length N.
2504
2505      `hilbert(F,[],DIM)' or `hilbert(F,N,DIM)' does the same along
2506      dimension dim.
2507
2508
2509
2510
2511 # name: <cell-element>
2512 # type: sq_string
2513 # elements: 1
2514 # length: 41
2515 Analytic extension of real valued signal
2516
2517
2518
2519
2520 # name: <cell-element>
2521 # type: sq_string
2522 # elements: 1
2523 # length: 4
2524 idct
2525
2526
2527 # name: <cell-element>
2528 # type: sq_string
2529 # elements: 1
2530 # length: 584
2531  y = dct (x, n)
2532     Computes the inverse discrete cosine transform of x.  If n is
2533     given, then x is padded or trimmed to length n before computing
2534     the transform. If x is a matrix, compute the transform along the
2535     columns of the the matrix. The transform is faster if x is
2536     real-valued and even length.
2537
2538  The inverse discrete cosine transform x of X can be defined as follows:
2539
2540           N-1
2541    x[n] = sum w(k) X[k] cos (pi (2n+1) k / 2N ),  n = 0, ..., N-1
2542           k=0
2543
2544  with w(0) = sqrt(1/N) and w(k) = sqrt(2/N), k = 1, ..., N-1
2545
2546  See also: idct, dct2, idct2, dctmtx
2547
2548
2549
2550 # name: <cell-element>
2551 # type: sq_string
2552 # elements: 1
2553 # length: 72
2554  y = dct (x, n)
2555     Computes the inverse discrete cosine transform of x.
2556
2557
2558
2559 # name: <cell-element>
2560 # type: sq_string
2561 # elements: 1
2562 # length: 5
2563 idct2
2564
2565
2566 # name: <cell-element>
2567 # type: sq_string
2568 # elements: 1
2569 # length: 221
2570  y = idct2 (x)
2571    Computes the inverse 2-D discrete cosine transform of matrix x
2572
2573  y = idct2 (x, m, n) or y = idct2 (x, [m n])
2574    Computes the 2-D inverse DCT of x after padding or trimming rows to m and
2575    columns to n.
2576
2577
2578
2579 # name: <cell-element>
2580 # type: sq_string
2581 # elements: 1
2582 # length: 80
2583  y = idct2 (x)
2584    Computes the inverse 2-D discrete cosine transform of matrix x
2585
2586
2587
2588 # name: <cell-element>
2589 # type: sq_string
2590 # elements: 1
2591 # length: 4
2592 idst
2593
2594
2595 # name: <cell-element>
2596 # type: sq_string
2597 # elements: 1
2598 # length: 333
2599  -- Function File: Y = idst (X)
2600  -- Function File: Y = idst (X, N)
2601      Computes the inverse type I discrete sine transform of Y.  If N is
2602      given, then Y is padded or trimmed to length N before computing
2603      the transform.  If Y is a matrix, compute the transform along the
2604      columns of the the matrix.
2605
2606      See also: dst
2607
2608
2609
2610
2611
2612 # name: <cell-element>
2613 # type: sq_string
2614 # elements: 1
2615 # length: 57
2616 Computes the inverse type I discrete sine transform of Y.
2617
2618
2619
2620 # name: <cell-element>
2621 # type: sq_string
2622 # elements: 1
2623 # length: 4
2624 ifht
2625
2626
2627 # name: <cell-element>
2628 # type: sq_string
2629 # elements: 1
2630 # length: 805
2631  -- Function File: m =  ifht ( d, n, dim )
2632      The function ifht calculates  Fast Hartley Transform  where D is
2633      the real input vector (matrix), and M is the real-transform
2634      vector. For matrices the hartley transform is calculated along the
2635      columns by default. The options N, and DIM are similar to the
2636      options of FFT function.
2637
2638      The forward and inverse hartley transforms are the same (except
2639      for a scale factor of 1/N for the inverse hartley transform), but
2640      implemented using different functions .
2641
2642      The definition of the forward hartley transform for vector d,
2643
2644      m[K] = 1/N \sum_i=0^N-1 d[i]*(cos[K*2*pi*i/N] + sin[K*2*pi*i/N]),
2645      for  0 <= K < N.  m[K] = 1/N \sum_i=0^N-1 d[i]*CAS[K*i], for  0 <=
2646      K < N.
2647
2648           ifht(1:4)
2649
2650      See also: fht, fft
2651
2652
2653
2654
2655
2656 # name: <cell-element>
2657 # type: sq_string
2658 # elements: 1
2659 # length: 80
2660 The function ifht calculates  Fast Hartley Transform  where D is the
2661 real input 
2662
2663
2664
2665 # name: <cell-element>
2666 # type: sq_string
2667 # elements: 1
2668 # length: 8
2669 iirlp2mb
2670
2671
2672 # name: <cell-element>
2673 # type: sq_string
2674 # elements: 1
2675 # length: 1305
2676  IIR Low Pass Filter to Multiband Filter Transformation
2677
2678  [Num,Den,AllpassNum,AllpassDen] = iirlp2mb(B,A,Wo,Wt)
2679  [Num,Den,AllpassNum,AllpassDen] = iirlp2mb(B,A,Wo,Wt,Pass)
2680
2681  Num,Den:               numerator,denominator of the transformed filter
2682  AllpassNum,AllpassDen: numerator,denominator of allpass transform,
2683  B,A:                   numerator,denominator of prototype low pass filter
2684  Wo:                    normalized_angular_frequency/pi to be transformed
2685  Wt:                    [phi=normalized_angular_frequencies]/pi target vector
2686  Pass:                  This parameter may have values 'pass' or 'stop'.  If
2687                         not given, it defaults to the value of 'pass'.
2688
2689  With normalized ang. freq. targets 0 < phi(1) <  ... < phi(n) < pi radians
2690
2691  for Pass == 'pass', the target multiband magnitude will be:
2692        --------       ----------        -----------...
2693       /        \     /          \      /            .
2694  0   phi(1) phi(2)  phi(3)   phi(4)   phi(5)   (phi(6))    pi
2695
2696  for Pass == 'stop', the target multiband magnitude will be:
2697  -------      ---------        ----------...
2698         \    /         \      /           .
2699  0   phi(1) phi(2)  phi(3)   phi(4)  (phi(5))              pi
2700
2701  Example of use:
2702  [B, A] = butter(6, 0.5);
2703  [Num, Den] = iirlp2mb(B, A, 0.5, [.2 .4 .6 .8]);
2704
2705
2706
2707 # name: <cell-element>
2708 # type: sq_string
2709 # elements: 1
2710 # length: 56
2711  IIR Low Pass Filter to Multiband Filter Transformation
2712
2713
2714
2715
2716 # name: <cell-element>
2717 # type: sq_string
2718 # elements: 1
2719 # length: 8
2720 impinvar
2721
2722
2723 # name: <cell-element>
2724 # type: sq_string
2725 # elements: 1
2726 # length: 877
2727  -- Function File: [B_OUT, A_OUT] = impinvar (B, A, FS, TOL)
2728  -- Function File: [B_OUT, A_OUT] = impinvar (B, A, FS)
2729  -- Function File: [B_OUT, A_OUT] = impinvar (B, A)
2730      Converts analog filter with coefficients B and A to digital,
2731      conserving impulse response.
2732
2733      If FS is not specificied, or is an empty vector, it defaults to
2734      1Hz.
2735
2736      If TOL is not specified, it defaults to 0.0001 (0.1%) This
2737      function does the inverse of impinvar so that the following
2738      example should restore the original values of A and B.
2739
2740      `invimpinvar' implements the reverse of this function.
2741           [b, a] = impinvar (b, a);
2742           [b, a] = invimpinvar (b, a);
2743
2744      Reference: Thomas J. Cavicchi (1996) "Impulse invariance and
2745      multiple-order poles". IEEE transactions on signal processing, Vol
2746      40 (9): 2344-2347
2747
2748      See also: bilinear, invimpinvar
2749
2750
2751
2752
2753
2754 # name: <cell-element>
2755 # type: sq_string
2756 # elements: 1
2757 # length: 80
2758 Converts analog filter with coefficients B and A to digital, conserving
2759 impulse 
2760
2761
2762
2763 # name: <cell-element>
2764 # type: sq_string
2765 # elements: 1
2766 # length: 4
2767 impz
2768
2769
2770 # name: <cell-element>
2771 # type: sq_string
2772 # elements: 1
2773 # length: 545
2774  usage: [x, t] = impz(b [, a, n, fs])
2775
2776  Generate impulse-response characteristics of the filter. The filter
2777  coefficients correspond to the the z-plane rational function with
2778  numerator b and denominator a.  If a is not specified, it defaults to
2779  1. If n is not specified, or specified as [], it will be chosen such
2780  that the signal has a chance to die down to -120dB, or to not explode
2781  beyond 120dB, or to show five periods if there is no significant
2782  damping. If no return arguments are requested, plot the results.
2783
2784  See also: freqz, zplane
2785
2786
2787
2788 # name: <cell-element>
2789 # type: sq_string
2790 # elements: 1
2791 # length: 38
2792  usage: [x, t] = impz(b [, a, n, fs])
2793
2794
2795
2796
2797 # name: <cell-element>
2798 # type: sq_string
2799 # elements: 1
2800 # length: 6
2801 interp
2802
2803
2804 # name: <cell-element>
2805 # type: sq_string
2806 # elements: 1
2807 # length: 631
2808  usage: y = interp(x, q [, n [, Wc]])
2809
2810  Upsample the signal x by a factor of q, using an order 2*q*n+1 FIR
2811  filter. Note that q must be an integer for this rate change method.
2812  n defaults to 4 and Wc defaults to 0.5.
2813
2814  Example
2815                                           # Generate a signal.
2816     t=0:0.01:2; x=chirp(t,2,.5,10,'quadratic')+sin(2*pi*t*0.4); 
2817     y = interp(x(1:4:length(x)),4,4,1);   # interpolate a sub-sample
2818     stem(t(1:121)*1000,x(1:121),"-g;Original;"); hold on;
2819     stem(t(1:121)*1000,y(1:121),"-r;Interpolated;");
2820     stem(t(1:4:121)*1000,x(1:4:121),"-b;Subsampled;"); hold off;
2821
2822  See also: decimate, resample
2823
2824
2825
2826 # name: <cell-element>
2827 # type: sq_string
2828 # elements: 1
2829 # length: 38
2830  usage: y = interp(x, q [, n [, Wc]])
2831
2832
2833
2834
2835 # name: <cell-element>
2836 # type: sq_string
2837 # elements: 1
2838 # length: 7
2839 invfreq
2840
2841
2842 # name: <cell-element>
2843 # type: sq_string
2844 # elements: 1
2845 # length: 1687
2846  usage: [B,A] = invfreq(H,F,nB,nA)
2847         [B,A] = invfreq(H,F,nB,nA,W)
2848         [B,A] = invfreq(H,F,nB,nA,W,[],[],plane)
2849         [B,A] = invfreq(H,F,nB,nA,W,iter,tol,plane)
2850
2851  Fit filter B(z)/A(z) or B(s)/A(s) to complex frequency response at 
2852  frequency points F. A and B are real polynomial coefficients of order 
2853  nA and nB respectively.  Optionally, the fit-errors can be weighted vs 
2854  frequency according to the weights W. Also, the transform plane can be
2855  specified as either 's' for continuous time or 'z' for discrete time. 'z'
2856  is chosen by default.  Eventually, Steiglitz-McBride iterations will be
2857  specified by iter and tol.
2858
2859  H: desired complex frequency response
2860      It is assumed that A and B are real polynomials, hence H is one-sided.
2861  F: vector of frequency samples in radians
2862  nA: order of denominator polynomial A
2863  nB: order of numerator polynomial B
2864  plane='z': F on unit circle (discrete-time spectra, z-plane design)
2865  plane='s': F on jw axis     (continuous-time spectra, s-plane design)
2866  H(k) = spectral samples of filter frequency response at points zk,
2867   where zk=exp(sqrt(-1)*F(k)) when plane='z' (F(k) in [0,.5])
2868      and zk=(sqrt(-1)*F(k)) when plane='s' (F(k) nonnegative)
2869  Example:
2870      [B,A] = butter(12,1/4);
2871      [H,w] = freqz(B,A,128);
2872      [Bh,Ah] = invfreq(H,F,4,4);
2873      Hh = freqz(Bh,Ah);
2874      disp(sprintf('||frequency response error|| = %f',norm(H-Hh)));
2875
2876  References: J. O. Smith, "Techniques for Digital Filter Design and System 
2877         Identification with Application to the Violin, Ph.D. Dissertation, 
2878         Elec. Eng. Dept., Stanford University, June 1983, page 50; or,
2879
2880  http://ccrma.stanford.edu/~jos/filters/FFT_Based_Equation_Error_Method.html
2881
2882
2883
2884 # name: <cell-element>
2885 # type: sq_string
2886 # elements: 1
2887 # length: 80
2888  usage: [B,A] = invfreq(H,F,nB,nA)
2889         [B,A] = invfreq(H,F,nB,nA,W)
2890         
2891
2892
2893
2894 # name: <cell-element>
2895 # type: sq_string
2896 # elements: 1
2897 # length: 8
2898 invfreqs
2899
2900
2901 # name: <cell-element>
2902 # type: sq_string
2903 # elements: 1
2904 # length: 943
2905  Usage: [B,A] = invfreqs(H,F,nB,nA)
2906         [B,A] = invfreqs(H,F,nB,nA,W)
2907         [B,A] = invfreqs(H,F,nB,nA,W,iter,tol,'trace')
2908
2909  Fit filter B(s)/A(s)to the complex frequency response H at frequency
2910  points F.  A and B are real polynomial coefficients of order nA and nB.
2911  Optionally, the fit-errors can be weighted vs frequency according to
2912  the weights W.
2913  Note: all the guts are in invfreq.m
2914
2915  H: desired complex frequency response
2916  F: frequency (must be same length as H)
2917  nA: order of the denominator polynomial A
2918  nB: order of the numerator polynomial B
2919  W: vector of weights (must be same length as F)
2920
2921  Example:
2922        B = [1/2 1];
2923        A = [1 1];
2924        w = linspace(0,4,128);
2925        H = freqs(B,A,w);
2926        [Bh,Ah] = invfreqs(H,w,1,1);
2927        Hh = freqs(Bh,Ah,w);
2928        plot(w,[abs(H);abs(Hh)])
2929        legend('Original','Measured');
2930        err = norm(H-Hh);
2931        disp(sprintf('L2 norm of frequency response error = %f',err));
2932
2933
2934
2935 # name: <cell-element>
2936 # type: sq_string
2937 # elements: 1
2938 # length: 80
2939  Usage: [B,A] = invfreqs(H,F,nB,nA)
2940         [B,A] = invfreqs(H,F,nB,nA,W)
2941       
2942
2943
2944
2945 # name: <cell-element>
2946 # type: sq_string
2947 # elements: 1
2948 # length: 8
2949 invfreqz
2950
2951
2952 # name: <cell-element>
2953 # type: sq_string
2954 # elements: 1
2955 # length: 819
2956  usage: [B,A] = invfreqz(H,F,nB,nA)
2957         [B,A] = invfreqz(H,F,nB,nA,W)
2958         [B,A] = invfreqz(H,F,nB,nA,W,iter,tol,'trace')
2959
2960  Fit filter B(z)/A(z)to the complex frequency response H at frequency
2961  points F.  A and B are real polynomial coefficients of order nA and nB.
2962  Optionally, the fit-errors can be weighted vs frequency according to
2963  the weights W.
2964  Note: all the guts are in invfreq.m
2965
2966  H: desired complex frequency response
2967  F: normalized frequncy (0 to pi) (must be same length as H)
2968  nA: order of the denominator polynomial A
2969  nB: order of the numerator polynomial B
2970  W: vector of weights (must be same length as F)
2971
2972  Example:
2973      [B,A] = butter(4,1/4);
2974      [H,F] = freqz(B,A);
2975      [Bh,Ah] = invfreq(H,F,4,4);
2976      Hh = freqz(Bh,Ah);
2977      disp(sprintf('||frequency response error|| = %f',norm(H-Hh)));
2978
2979
2980
2981 # name: <cell-element>
2982 # type: sq_string
2983 # elements: 1
2984 # length: 80
2985  usage: [B,A] = invfreqz(H,F,nB,nA)
2986         [B,A] = invfreqz(H,F,nB,nA,W)
2987       
2988
2989
2990
2991 # name: <cell-element>
2992 # type: sq_string
2993 # elements: 1
2994 # length: 11
2995 invimpinvar
2996
2997
2998 # name: <cell-element>
2999 # type: sq_string
3000 # elements: 1
3001 # length: 823
3002  -- Function File: [B_OUT, A_OUT] = invimpinvar (B, A, FS, TOL)
3003  -- Function File: [B_OUT, A_OUT] = invimpinvar (B, A, FS)
3004  -- Function File: [B_OUT, A_OUT] = invimpinvar (B, A)
3005      Converts digital filter with coefficients B and A to analog,
3006      conserving impulse response.
3007
3008      This function does the inverse of impinvar so that the following
3009      example should restore the original values of A and B.
3010           [b, a] = impinvar (b, a);
3011           [b, a] = invimpinvar (b, a);
3012
3013      If FS is not specificied, or is an empty vector, it defaults to
3014      1Hz.
3015
3016      If TOL is not specified, it defaults to 0.0001 (0.1%)
3017
3018      Reference: Thomas J. Cavicchi (1996) "Impulse invariance and
3019      multiple-order poles". IEEE transactions on signal processing, Vol
3020      40 (9): 2344-2347
3021
3022      See also: bilinear, impinvar
3023
3024
3025
3026
3027
3028 # name: <cell-element>
3029 # type: sq_string
3030 # elements: 1
3031 # length: 80
3032 Converts digital filter with coefficients B and A to analog, conserving
3033 impulse 
3034
3035
3036
3037 # name: <cell-element>
3038 # type: sq_string
3039 # elements: 1
3040 # length: 6
3041 kaiser
3042
3043
3044 # name: <cell-element>
3045 # type: sq_string
3046 # elements: 1
3047 # length: 454
3048  usage:  kaiser (L, beta)
3049
3050  Returns the filter coefficients of the L-point Kaiser window with
3051  parameter beta.
3052
3053  For the definition of the Kaiser window, see A. V. Oppenheim &
3054  R. W. Schafer, "Discrete-Time Signal Processing".
3055
3056  The continuous version of width L centered about x=0 is:
3057
3058          besseli(0, beta * sqrt(1-(2*x/L).^2))
3059  k(x) =  -------------------------------------,  L/2 <= x <= L/2
3060                 besseli(0, beta)
3061
3062  See also: kaiserord
3063
3064
3065
3066 # name: <cell-element>
3067 # type: sq_string
3068 # elements: 1
3069 # length: 26
3070  usage:  kaiser (L, beta)
3071
3072
3073
3074
3075 # name: <cell-element>
3076 # type: sq_string
3077 # elements: 1
3078 # length: 9
3079 kaiserord
3080
3081
3082 # name: <cell-element>
3083 # type: sq_string
3084 # elements: 1
3085 # length: 1809
3086  usage: [n, Wn, beta, ftype] = kaiserord(f, m, dev [, fs])
3087
3088  Returns the parameters needed for fir1 to produce a filter of the
3089  desired specification from a kaiser window:
3090        n: order of the filter (length of filter minus 1)
3091        Wn: band edges for use in fir1
3092        beta: parameter for kaiser window of length n+1
3093        ftype: choose between pass and stop bands
3094        b = fir1(n,Wn,kaiser(n+1,beta),ftype,'noscale');
3095
3096  f: frequency bands, given as pairs, with the first half of the
3097     first pair assumed to start at 0 and the last half of the last
3098     pair assumed to end at 1.  It is important to separate the
3099     band edges, since narrow transition regions require large order
3100     filters.
3101  m: magnitude within each band.  Should be non-zero for pass band
3102     and zero for stop band.  All passbands must have the same
3103     magnitude, or you will get the error that pass and stop bands
3104     must be strictly alternating.
3105  dev: deviation within each band.  Since all bands in the resulting
3106     filter have the same deviation, only the minimum deviation is
3107     used.  In this version, a single scalar will work just as well.
3108  fs: sampling rate.  Used to convert the frequency specification into
3109     the [0, 1], where 1 corresponds to the Nyquist frequency, fs/2.
3110
3111  The Kaiser window parameters n and beta are computed from the
3112  relation between ripple (A=-20*log10(dev)) and transition width
3113  (dw in radians) discovered empirically by Kaiser:
3114
3115            / 0.1102(A-8.7)                        A > 50
3116     beta = | 0.5842(A-21)^0.4 + 0.07886(A-21)     21 <= A <= 50
3117            \ 0.0                                  A < 21
3118
3119     n = (A-8)/(2.285 dw)
3120
3121  Example
3122     [n, w, beta, ftype] = kaiserord([1000,1200], [1,0], [0.05,0.05], 11025);
3123     freqz(fir1(n,w,kaiser(n+1,beta),ftype,'noscale'),1,[],11025);
3124
3125
3126
3127 # name: <cell-element>
3128 # type: sq_string
3129 # elements: 1
3130 # length: 59
3131  usage: [n, Wn, beta, ftype] = kaiserord(f, m, dev [, fs])
3132
3133
3134
3135
3136 # name: <cell-element>
3137 # type: sq_string
3138 # elements: 1
3139 # length: 8
3140 levinson
3141
3142
3143 # name: <cell-element>
3144 # type: sq_string
3145 # elements: 1
3146 # length: 818
3147  usage:  [a, v, ref] = levinson (acf [, p])
3148
3149  Use the Durbin-Levinson algorithm to solve:
3150     toeplitz(acf(1:p)) * x = -acf(2:p+1).
3151  The solution [1, x'] is the denominator of an all pole filter
3152  approximation to the signal x which generated the autocorrelation
3153  function acf.  
3154
3155  acf is the autocorrelation function for lags 0 to p.
3156  p defaults to length(acf)-1.
3157  Returns 
3158    a=[1, x'] the denominator filter coefficients. 
3159    v= variance of the white noise = square of the numerator constant
3160    ref = reflection coefficients = coefficients of the lattice
3161          implementation of the filter
3162  Use freqz(sqrt(v),a) to plot the power spectrum.
3163
3164  REFERENCE
3165  [1] Steven M. Kay and Stanley Lawrence Marple Jr.:
3166    "Spectrum analysis -- a modern perspective",
3167    Proceedings of the IEEE, Vol 69, pp 1380-1419, Nov., 1981
3168
3169
3170
3171 # name: <cell-element>
3172 # type: sq_string
3173 # elements: 1
3174 # length: 44
3175  usage:  [a, v, ref] = levinson (acf [, p])
3176
3177
3178
3179
3180 # name: <cell-element>
3181 # type: sq_string
3182 # elements: 1
3183 # length: 7
3184 marcumq
3185
3186
3187 # name: <cell-element>
3188 # type: sq_string
3189 # elements: 1
3190 # length: 963
3191  -- Function File: Q =  marcumq (A, B)
3192  -- Function File: Q =  marcumq (A, B, M)
3193  -- Function File: Q =  marcumq (A, B, M, TOL)
3194      Compute the generalized Marcum Q function of order M with
3195      noncentrality parameter A and argument B.  If the order M is
3196      omitted it defaults to 1.  An optional relative tolerance TOL may
3197      be included, the default is `eps'.
3198
3199      If the input arguments are commensurate vectors, this function
3200      will produce a table of values.
3201
3202      This function computes Marcum's Q function using the infinite
3203      Bessel series, truncated when the relative error is less than the
3204      specified tolerance.  The accuracy is limited by that of the
3205      Bessel functions, so reducing the tolerance is probably not useful.
3206
3207      Reference: Marcum, "Tables of Q Functions", Rand Corporation.
3208
3209      Reference: R.T. Short, "Computation of Noncentral Chi-squared and
3210      Rice Random Variables", www.phaselockedsystems.com/publications
3211
3212
3213
3214
3215
3216 # name: <cell-element>
3217 # type: sq_string
3218 # elements: 1
3219 # length: 80
3220 Compute the generalized Marcum Q function of order M with noncentrality
3221 paramete
3222
3223
3224
3225 # name: <cell-element>
3226 # type: sq_string
3227 # elements: 1
3228 # length: 7
3229 mexihat
3230
3231
3232 # name: <cell-element>
3233 # type: sq_string
3234 # elements: 1
3235 # length: 85
3236  -- Function File: [PSI,X] = mexihat(LB,UB,N)
3237      Compute the Mexican hat wavelet.
3238
3239
3240
3241
3242 # name: <cell-element>
3243 # type: sq_string
3244 # elements: 1
3245 # length: 32
3246 Compute the Mexican hat wavelet.
3247
3248
3249
3250 # name: <cell-element>
3251 # type: sq_string
3252 # elements: 1
3253 # length: 8
3254 meyeraux
3255
3256
3257 # name: <cell-element>
3258 # type: sq_string
3259 # elements: 1
3260 # length: 89
3261  -- Function File: [Y] = meyeraux(X)
3262      Compute the Meyer wavelet auxiliary function.
3263
3264
3265
3266
3267 # name: <cell-element>
3268 # type: sq_string
3269 # elements: 1
3270 # length: 45
3271 Compute the Meyer wavelet auxiliary function.
3272
3273
3274
3275 # name: <cell-element>
3276 # type: sq_string
3277 # elements: 1
3278 # length: 6
3279 morlet
3280
3281
3282 # name: <cell-element>
3283 # type: sq_string
3284 # elements: 1
3285 # length: 79
3286  -- Function File: [PSI,X] = morlet(LB,UB,N)
3287      Compute the Morlet wavelet.
3288
3289
3290
3291
3292 # name: <cell-element>
3293 # type: sq_string
3294 # elements: 1
3295 # length: 27
3296 Compute the Morlet wavelet.
3297
3298
3299
3300 # name: <cell-element>
3301 # type: sq_string
3302 # elements: 1
3303 # length: 8
3304 mscohere
3305
3306
3307 # name: <cell-element>
3308 # type: sq_string
3309 # elements: 1
3310 # length: 270
3311  Usage:
3312    [Pxx,freq]=mscohere(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
3313
3314      Estimate (mean square) coherence of signals "x" and "y".
3315      Use the Welch (1967) periodogram/FFT method.
3316      See "help pwelch" for description of arguments, hints and references
3317
3318
3319
3320 # name: <cell-element>
3321 # type: sq_string
3322 # elements: 1
3323 # length: 80
3324  Usage:
3325    [Pxx,freq]=mscohere(x,y,Nfft,Fs,window,overlap,range,plot_type,detren
3326
3327
3328
3329 # name: <cell-element>
3330 # type: sq_string
3331 # elements: 1
3332 # length: 6
3333 ncauer
3334
3335
3336 # name: <cell-element>
3337 # type: sq_string
3338 # elements: 1
3339 # length: 383
3340  usage: [Zz, Zp, Zg] = ncauer(Rp, Rs, n)
3341
3342  Analog prototype for Cauer filter.
3343  [z, p, g]=ncauer(Rp, Rs, ws)
3344  Rp = Passband ripple
3345  Rs = Stopband ripple
3346  Ws = Desired order
3347
3348  References: 
3349
3350  - Serra, Celso Penteado, Teoria e Projeto de Filtros, Campinas: CARTGRAF, 
3351    1983.
3352  - Lamar, Marcus Vinicius, Notas de aula da disciplina TE 456 - Circuitos 
3353    Analogicos II, UFPR, 2001/2002.
3354
3355
3356
3357 # name: <cell-element>
3358 # type: sq_string
3359 # elements: 1
3360 # length: 41
3361  usage: [Zz, Zp, Zg] = ncauer(Rp, Rs, n)
3362
3363
3364
3365
3366 # name: <cell-element>
3367 # type: sq_string
3368 # elements: 1
3369 # length: 10
3370 nuttallwin
3371
3372
3373 # name: <cell-element>
3374 # type: sq_string
3375 # elements: 1
3376 # length: 154
3377  -- Function File: [W] = nuttallwin(L)
3378      Compute the Blackman-Harris window defined by Nuttall of length L.
3379
3380      See also: blackman, blackmanharris
3381
3382
3383
3384
3385
3386 # name: <cell-element>
3387 # type: sq_string
3388 # elements: 1
3389 # length: 66
3390 Compute the Blackman-Harris window defined by Nuttall of length L.
3391
3392
3393
3394 # name: <cell-element>
3395 # type: sq_string
3396 # elements: 1
3397 # length: 9
3398 parzenwin
3399
3400
3401 # name: <cell-element>
3402 # type: sq_string
3403 # elements: 1
3404 # length: 118
3405  -- Function File: [W] = parzenwin(L)
3406      Compute the Parzen window of lenght L.
3407
3408      See also: rectwin, bartlett
3409
3410
3411
3412
3413
3414 # name: <cell-element>
3415 # type: sq_string
3416 # elements: 1
3417 # length: 38
3418 Compute the Parzen window of lenght L.
3419
3420
3421
3422 # name: <cell-element>
3423 # type: sq_string
3424 # elements: 1
3425 # length: 5
3426 pburg
3427
3428
3429 # name: <cell-element>
3430 # type: sq_string
3431 # elements: 1
3432 # length: 3783
3433  usage:
3434     [psd,f_out] = pburg(x,poles,freq,Fs,range,method,plot_type,criterion)
3435
3436  Calculate Burg maximum-entropy power spectral density.
3437  The functions "arburg" and "ar_psd" do all the work.
3438  See "help arburg" and "help ar_psd" for further details.
3439
3440  ARGUMENTS:
3441      All but the first two arguments are optional and may be empty.
3442    x       %% [vector] sampled data
3443
3444    poles   %% [integer scalar] required number of poles of the AR model
3445
3446    freq    %% [real vector] frequencies at which power spectral density
3447            %%               is calculated
3448            %% [integer scalar] number of uniformly distributed frequency
3449            %%          values at which spectral density is calculated.
3450            %%          [default=256]
3451
3452    Fs      %% [real scalar] sampling frequency (Hertz) [default=1]
3453
3454
3455  CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
3456    Control-string arguments can be in any order after the other arguments.
3457
3458
3459    range   %% 'half',  'onesided' : frequency range of the spectrum is
3460            %%       from zero up to but not including sample_f/2.  Power
3461            %%       from negative frequencies is added to the positive
3462            %%       side of the spectrum.
3463            %% 'whole', 'twosided' : frequency range of the spectrum is
3464            %%       -sample_f/2 to sample_f/2, with negative frequencies
3465            %%       stored in "wrap around" order after the positive
3466            %%       frequencies; e.g. frequencies for a 10-point 'twosided'
3467            %%       spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
3468            %% 'shift', 'centerdc' : same as 'whole' but with the first half
3469            %%       of the spectrum swapped with second half to put the
3470            %%       zero-frequency value in the middle. (See "help
3471            %%       fftshift". If "freq" is vector, 'shift' is ignored.
3472            %% If model coefficients "ar_coeffs" are real, the default
3473            %% range is 'half', otherwise default range is 'whole'.
3474
3475    method  %% 'fft':  use FFT to calculate power spectral density.
3476            %% 'poly': calculate spectral density as a polynomial of 1/z
3477            %% N.B. this argument is ignored if the "freq" argument is a
3478            %%      vector.  The default is 'poly' unless the "freq"
3479            %%      argument is an integer power of 2.
3480    
3481  plot_type %% 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
3482            %% specifies the type of plot.  The default is 'plot', which
3483            %% means linear-linear axes. 'squared' is the same as 'plot'.
3484            %% 'dB' plots "10*log10(psd)".  This argument is ignored and a
3485            %% spectrum is not plotted if the caller requires a returned
3486            %% value.
3487
3488  criterion %% [optional string arg]  model-selection criterion.  Limits
3489            %%       the number of poles so that spurious poles are not 
3490            %%       added when the whitened data has no more information
3491            %%       in it (see Kay & Marple, 1981). Recognised values are
3492            %%  'AKICc' -- approximate corrected Kullback information
3493            %%             criterion (recommended),
3494            %%   'KIC'  -- Kullback information criterion
3495            %%   'AICc' -- corrected Akaike information criterion
3496            %%   'AIC'  -- Akaike information criterion
3497            %%   'FPE'  -- final prediction error" criterion
3498            %% The default is to NOT use a model-selection criterion
3499
3500  RETURNED VALUES:
3501      If return values are not required by the caller, the spectrum
3502      is plotted and nothing is returned.
3503    psd       %% [real vector] power-spectral density estimate 
3504    f_out     %% [real vector] frequency values 
3505
3506  HINTS
3507    This function is a wrapper for arburg and ar_psd.
3508    See "help arburg", "help ar_psd".
3509
3510
3511
3512 # name: <cell-element>
3513 # type: sq_string
3514 # elements: 1
3515 # length: 80
3516  usage:
3517     [psd,f_out] = pburg(x,poles,freq,Fs,range,method,plot_type,criterion
3518
3519
3520
3521 # name: <cell-element>
3522 # type: sq_string
3523 # elements: 1
3524 # length: 15
3525 pei_tseng_notch
3526
3527
3528 # name: <cell-element>
3529 # type: sq_string
3530 # elements: 1
3531 # length: 707
3532  -- Function File:  [ B, A ]  = pei_tseng_notch ( FREQUENCIES,
3533           BANDWIDTHS
3534      Return coefficients for an IIR notch-filter with one or more
3535      filter frequencies and according (very narrow) bandwidths to be
3536      used with `filter' or `filtfilt'.  The filter construction is
3537      based on an allpass which performs a reversal of phase at the
3538      filter frequencies.  Thus, the mean of the phase-distorted and the
3539      original signal has the respective frequencies removed.  See the
3540      demo for an illustration.
3541
3542      Original source: Pei, Soo-Chang, and Chien-Cheng Tseng "IIR
3543      Multiple Notch Filter Design Based on Allpass Filter" 1996 IEEE
3544      Tencon doi: 10.1109/TENCON.1996.608814)
3545
3546
3547
3548
3549 # name: <cell-element>
3550 # type: sq_string
3551 # elements: 1
3552 # length: 80
3553 Return coefficients for an IIR notch-filter with one or more filter
3554 frequencies 
3555
3556
3557
3558 # name: <cell-element>
3559 # type: sq_string
3560 # elements: 1
3561 # length: 8
3562 polystab
3563
3564
3565 # name: <cell-element>
3566 # type: sq_string
3567 # elements: 1
3568 # length: 156
3569  b = polystab(a)
3570
3571  Stabalize the polynomial transfer function by replacing all roots
3572  outside the unit circle with their reflection inside the unit circle.
3573
3574
3575
3576 # name: <cell-element>
3577 # type: sq_string
3578 # elements: 1
3579 # length: 17
3580  b = polystab(a)
3581
3582
3583
3584
3585 # name: <cell-element>
3586 # type: sq_string
3587 # elements: 1
3588 # length: 8
3589 pulstran
3590
3591
3592 # name: <cell-element>
3593 # type: sq_string
3594 # elements: 1
3595 # length: 1187
3596  usage: y=pulstran(t,d,'func',...)
3597         y=pulstran(t,d,p,Fs,'interp')
3598
3599  Generate the signal y=sum(func(t+d,...)) for each d.  If d is a
3600  matrix of two columns, the first column is the delay d and the second
3601  column is the amplitude a, and y=sum(a*func(t+d)) for each d,a.
3602  Clearly, func must be a function which accepts a vector of times.
3603  Any extra arguments needed for the function must be tagged on the end.
3604
3605  Example
3606    fs = 11025;  # arbitrary sample rate
3607    f0 = 100;    # pulse train sample rate
3608    w = 0.001;   # pulse width of 1 millisecond
3609    auplot(pulstran(0:1/fs:0.1, 0:1/f0:0.1, 'rectpuls', w), fs);
3610
3611  If instead of a function name you supply a pulse shape sampled at
3612  frequency Fs (default 1 Hz),  an interpolated version of the pulse
3613  is added at each delay d.  The interpolation stays within the the
3614  time range of the delayed pulse.  The interpolation method defaults
3615  to linear, but it can be any interpolation method accepted by the
3616  function interp1.
3617
3618  Example
3619    fs = 11025;  # arbitrary sample rate
3620    f0 = 100;    # pulse train sample rate
3621    w = boxcar(10);  # pulse width of 1 millisecond at 10 kHz
3622    auplot(pulstran(0:1/fs:0.1, 0:1/f0:0.1, w, 10000), fs);
3623
3624
3625
3626 # name: <cell-element>
3627 # type: sq_string
3628 # elements: 1
3629 # length: 31
3630  usage: y=pulstran(t,d,'func',.
3631
3632
3633
3634 # name: <cell-element>
3635 # type: sq_string
3636 # elements: 1
3637 # length: 6
3638 pwelch
3639
3640
3641 # name: <cell-element>
3642 # type: sq_string
3643 # elements: 1
3644 # length: 7140
3645  USAGE:
3646    [spectra,freq] = pwelch(x,window,overlap,Nfft,Fs,
3647                            range,plot_type,detrend,sloppy)
3648      Estimate power spectral density of data "x" by the Welch (1967)
3649      periodogram/FFT method.  All arguments except "x" are optional.
3650          The data is divided into segments.  If "window" is a vector, each
3651      segment has the same length as "window" and is multiplied by "window"
3652      before (optional) zero-padding and calculation of its periodogram. If
3653      "window" is a scalar, each segment has a length of "window" and a
3654      Hamming window is used.
3655          The spectral density is the mean of the periodograms, scaled so that
3656      area under the spectrum is the same as the mean square of the
3657      data.  This equivalence is supposed to be exact, but in practice there
3658      is a mismatch of up to 0.5% when comparing area under a periodogram
3659      with the mean square of the data.
3660
3661   [spectra,freq] = pwelch(x,y,window,overlap,Nfft,Fs,
3662                           range,plot_type,detrend,sloppy,results)
3663      Two-channel spectrum analyser.  Estimate power spectral density, cross-
3664      spectral density, transfer function and/or coherence functions of time-
3665      series input data "x" and output data "y" by the Welch (1967)
3666      periodogram/FFT method.
3667        pwelch treats the second argument as "y" if there is a control-string
3668      argument "cross", "trans", "coher" or "ypower"; "power" does not force
3669      the 2nd argument to be treated as "y".  All other arguments are
3670      optional.  All spectra are returned in matrix "spectra". 
3671
3672   [spectra,Pxx_ci,freq] = pwelch(x,window,overlap,Nfft,Fs,conf,
3673                                  range,plot_type,detrend,sloppy)
3674   [spectra,Pxx_ci,freq] = pwelch(x,y,window,overlap,Nfft,Fs,conf,
3675                                  range,plot_type,detrend,sloppy,results)
3676      Estimates confidence intervals for the spectral density.
3677      See Hint (7) below for compatibility options.  Confidence level "conf"
3678      is the 6th or 7th numeric argument.  If "results" control-string 
3679      arguments are used, one of them must be "power" when the "conf"
3680      argument is present; pwelch can estimate confidence intervals only for
3681      the power spectrum of the "x" data.  It does not know how to estimate
3682      confidence intervals of the cross-power spectrum, transfer function or
3683      coherence; if you can suggest a good method, please send a bug report.
3684
3685  ARGUMENTS
3686  All but the first argument are optional and may be empty, except that
3687  the "results" argument may require the second argument to be "y".
3688
3689  x           %% [non-empty vector] system-input time-series data
3690  y           %% [non-empty vector] system-output time-series data
3691
3692  window      %% [real vector] of window-function values between 0 and 1; the
3693              %%       data segment has the same length as the window.
3694              %%       Default window shape is Hamming.
3695              %% [integer scalar] length of each data segment.  The default
3696              %%       value is window=sqrt(length(x)) rounded up to the
3697              %%       nearest integer power of 2; see 'sloppy' argument.
3698
3699  overlap     %% [real scalar] segment overlap expressed as a multiple of
3700              %%       window or segment length.   0 <= overlap < 1,
3701              %%       The default is overlap=0.5 .
3702
3703  Nfft        %% [integer scalar] Length of FFT.  The default is the length
3704              %%       of the "window" vector or has the same value as the
3705              %%       scalar "window" argument.  If Nfft is larger than the
3706              %%       segment length, "seg_len", the data segment is padded
3707              %%       with "Nfft-seg_len" zeros.  The default is no padding.
3708              %%       Nfft values smaller than the length of the data
3709              %%       segment (or window) are ignored silently.
3710
3711  Fs          %% [real scalar] sampling frequency (Hertz); default=1.0
3712
3713  conf        %% [real scalar] confidence level between 0 and 1.  Confidence
3714              %%       intervals of the spectral density are estimated from
3715              %%       scatter in the periodograms and are returned as Pxx_ci.
3716              %%       Pxx_ci(:,1) is the lower bound of the confidence
3717              %%       interval and Pxx_ci(:,2) is the upper bound.  If there
3718              %%       are three return values, or conf is an empty matrix,
3719              %%       confidence intervals are calculated for conf=0.95 .
3720              %%       If conf is zero or is not given, confidence intervals
3721              %%       are not calculated. Confidence intervals can be 
3722              %%       obtained only for the power spectral density of x;
3723              %%       nothing else.
3724
3725  CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
3726    Control-string arguments must be after the other arguments but can be in
3727    any order.
3728   
3729  range     %% 'half',  'onesided' : frequency range of the spectrum is
3730            %%       zero up to but not including Fs/2.  Power from
3731            %%       negative frequencies is added to the positive side of
3732            %%       the spectrum, but not at zero or Nyquist (Fs/2)
3733            %%       frequencies.  This keeps power equal in time and
3734            %%       spectral domains.  See reference [2].
3735            %% 'whole', 'twosided' : frequency range of the spectrum is
3736            %%       -Fs/2 to Fs/2, with negative frequencies
3737            %%       stored in "wrap around" order after the positive
3738            %%       frequencies; e.g. frequencies for a 10-point 'twosided'
3739            %%       spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
3740            %% 'shift', 'centerdc' : same as 'whole' but with the first half
3741            %%       of the spectrum swapped with second half to put the
3742            %%       zero-frequency value in the middle. (See "help
3743            %%       fftshift".
3744            %% If data (x and y) are real, the default range is 'half',
3745            %% otherwise default range is 'whole'.
3746
3747  plot_type %% 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
3748            %% specifies the type of plot.  The default is 'plot', which
3749            %% means linear-linear axes. 'squared' is the same as 'plot'.
3750            %% 'dB' plots "10*log10(psd)".  This argument is ignored and a
3751            %% spectrum is not plotted if the caller requires a returned
3752            %% value.
3753
3754  detrend   %% 'no-strip', 'none' -- do NOT remove mean value from the data
3755            %% 'short', 'mean' -- remove the mean value of each segment from
3756            %%                    each segment of the data.
3757            %% 'linear',       -- remove linear trend from each segment of
3758            %%                    the data.
3759            %% 'long-mean'     -- remove the mean value from the data before
3760            %%              splitting it into segments.  This is the default.
3761
3762    sloppy  %% 'sloppy': FFT length is rounded up to the nearest integer
3763            %%       power of 2 by zero padding.  FFT length is adjusted
3764            %%       after addition of padding by explicit Nfft argument.
3765            %%       The default is to use exactly the FFT and window/
3766
3767
3768
3769 # name: <cell-element>
3770 # type: sq_string
3771 # elements: 1
3772 # length: 80
3773  USAGE:
3774    [spectra,freq] = pwelch(x,window,overlap,Nfft,Fs,
3775                    
3776
3777
3778
3779 # name: <cell-element>
3780 # type: sq_string
3781 # elements: 1
3782 # length: 7
3783 pyulear
3784
3785
3786 # name: <cell-element>
3787 # type: sq_string
3788 # elements: 1
3789 # length: 3140
3790  usage:
3791     [psd,f_out] = pyulear(x,poles,freq,Fs,range,method,plot_type)
3792
3793  Calculates a Yule-Walker autoregressive (all-pole) model of the data "x"
3794  and computes the power spectrum of the model.  This is a wrapper for
3795  functions "aryule" and "ar_psd" which perform the argument checking.
3796  See "help aryule" and "help ar_psd" for further details.
3797
3798  ARGUMENTS:
3799      All but the first two arguments are optional and may be empty.
3800    x       %% [vector] sampled data
3801
3802    poles   %% [integer scalar] required number of poles of the AR model
3803
3804    freq    %% [real vector] frequencies at which power spectral density
3805            %%               is calculated
3806            %% [integer scalar] number of uniformly distributed frequency
3807            %%          values at which spectral density is calculated.
3808            %%          [default=256]
3809
3810    Fs      %% [real scalar] sampling frequency (Hertz) [default=1]
3811
3812
3813  CONTROL-STRING ARGUMENTS -- each of these arguments is a character string.
3814    Control-string arguments can be in any order after the other arguments.
3815
3816
3817    range   %% 'half',  'onesided' : frequency range of the spectrum is
3818            %%       from zero up to but not including sample_f/2.  Power
3819            %%       from negative frequencies is added to the positive
3820            %%       side of the spectrum.
3821            %% 'whole', 'twosided' : frequency range of the spectrum is
3822            %%       -sample_f/2 to sample_f/2, with negative frequencies
3823            %%       stored in "wrap around" order after the positive
3824            %%       frequencies; e.g. frequencies for a 10-point 'twosided'
3825            %%       spectrum are 0 0.1 0.2 0.3 0.4 0.5 -0.4 -0.3 -0.2 -0.1
3826            %% 'shift', 'centerdc' : same as 'whole' but with the first half
3827            %%       of the spectrum swapped with second half to put the
3828            %%       zero-frequency value in the middle. (See "help
3829            %%       fftshift". If "freq" is vector, 'shift' is ignored.
3830            %% If model coefficients "ar_coeffs" are real, the default
3831            %% range is 'half', otherwise default range is 'whole'.
3832
3833    method  %% 'fft':  use FFT to calculate power spectrum.
3834            %% 'poly': calculate power spectrum as a polynomial of 1/z
3835            %% N.B. this argument is ignored if the "freq" argument is a
3836            %%      vector.  The default is 'poly' unless the "freq"
3837            %%      argument is an integer power of 2.
3838    
3839  plot_type %% 'plot', 'semilogx', 'semilogy', 'loglog', 'squared' or 'db':
3840            %% specifies the type of plot.  The default is 'plot', which
3841            %% means linear-linear axes. 'squared' is the same as 'plot'.
3842            %% 'dB' plots "10*log10(psd)".  This argument is ignored and a
3843            %% spectrum is not plotted if the caller requires a returned
3844            %% value.
3845
3846  RETURNED VALUES:
3847      If return values are not required by the caller, the spectrum
3848      is plotted and nothing is returned.
3849    psd     %% [real vector] power-spectrum estimate 
3850    f_out   %% [real vector] frequency values 
3851
3852  HINTS
3853    This function is a wrapper for aryule and ar_psd.
3854    See "help aryule", "help ar_psd".
3855
3856
3857
3858 # name: <cell-element>
3859 # type: sq_string
3860 # elements: 1
3861 # length: 74
3862  usage:
3863     [psd,f_out] = pyulear(x,poles,freq,Fs,range,method,plot_type)
3864
3865
3866
3867
3868 # name: <cell-element>
3869 # type: sq_string
3870 # elements: 1
3871 # length: 9
3872 qp_kaiser
3873
3874
3875 # name: <cell-element>
3876 # type: sq_string
3877 # elements: 1
3878 # length: 602
3879  Usage:  qp_kaiser (nb, at, linear)
3880
3881  Computes a finite impulse response (FIR) filter for use with a
3882  quasi-perfect reconstruction polyphase-network filter bank. This
3883  version utilizes a Kaiser window to shape the frequency response of
3884  the designed filter. Tha number nb of bands and the desired
3885  attenuation at in the stop-band are given as parameters.
3886
3887  The Kaiser window is multiplied by the ideal impulse response
3888  h(n)=a.sinc(a.n) and converted to its minimum-phase version by means
3889  of a Hilbert transform.
3890
3891  By using a third non-null argument, the minimum-phase calculation is
3892  ommited at all.
3893
3894
3895
3896 # name: <cell-element>
3897 # type: sq_string
3898 # elements: 1
3899 # length: 36
3900  Usage:  qp_kaiser (nb, at, linear)
3901
3902
3903
3904
3905 # name: <cell-element>
3906 # type: sq_string
3907 # elements: 1
3908 # length: 5
3909 rceps
3910
3911
3912 # name: <cell-element>
3913 # type: sq_string
3914 # elements: 1
3915 # length: 693
3916  usage: [y, xm] = rceps(x)
3917    Produce the cepstrum of the signal x, and if desired, the minimum
3918    phase reconstruction of the signal x.  If x is a matrix, do so
3919    for each column of the matrix.
3920
3921  Example
3922    f0=70; Fs=10000;           # 100 Hz fundamental, 10kHz sampling rate
3923    a=poly(0.985*exp(1i*pi*[0.1, -0.1, 0.3, -0.3])); # two formants
3924    s=0.005*randn(1024,1);      # Noise excitation signal
3925    s(1:Fs/f0:length(s)) = 1;   # Impulse glottal wave
3926    x=filter(1,a,s);            # Speech signal in x
3927    [y, xm] = rceps(x.*hanning(1024)); # cepstrum and min phase reconstruction
3928
3929  Reference
3930     Programs for digital signal processing. IEEE Press.
3931     New York: John Wiley & Sons. 1979.
3932
3933
3934
3935 # name: <cell-element>
3936 # type: sq_string
3937 # elements: 1
3938 # length: 80
3939  usage: [y, xm] = rceps(x)
3940    Produce the cepstrum of the signal x, and if desir
3941
3942
3943
3944 # name: <cell-element>
3945 # type: sq_string
3946 # elements: 1
3947 # length: 8
3948 rectpuls
3949
3950
3951 # name: <cell-element>
3952 # type: sq_string
3953 # elements: 1
3954 # length: 429
3955  usage: y = rectpuls(t, w)
3956
3957  Generate a rectangular pulse over the interval [-w/2,w/2), sampled at
3958  times t.  This is useful with the function pulstran for generating a
3959  series pulses.
3960
3961  Example
3962    fs = 11025;  # arbitrary sample rate
3963    f0 = 100;    # pulse train sample rate
3964    w = 0.3/f0;  # pulse width 3/10th the distance between pulses
3965    auplot(pulstran(0:1/fs:4/f0, 0:1/f0:4/f0, 'rectpuls', w), fs);
3966
3967  See also: pulstran
3968
3969
3970
3971 # name: <cell-element>
3972 # type: sq_string
3973 # elements: 1
3974 # length: 27
3975  usage: y = rectpuls(t, w)
3976
3977
3978
3979
3980 # name: <cell-element>
3981 # type: sq_string
3982 # elements: 1
3983 # length: 7
3984 rectwin
3985
3986
3987 # name: <cell-element>
3988 # type: sq_string
3989 # elements: 1
3990 # length: 142
3991  -- Function File: [W] = rectwin(L)
3992      Return the filter coefficients of a rectangle window of length L.
3993
3994      See also: hamming, hanning
3995
3996
3997
3998
3999
4000 # name: <cell-element>
4001 # type: sq_string
4002 # elements: 1
4003 # length: 65
4004 Return the filter coefficients of a rectangle window of length L.
4005
4006
4007
4008 # name: <cell-element>
4009 # type: sq_string
4010 # elements: 1
4011 # length: 8
4012 resample
4013
4014
4015 # name: <cell-element>
4016 # type: sq_string
4017 # elements: 1
4018 # length: 637
4019  -- Function File: [Y H]= resample(X,P,Q)
4020  -- Function File: Y = resample(X,P,Q,H)
4021      Change the sample rate of X by a factor of P/Q. This is performed
4022      using a polyphase algorithm. The impulse response H of the
4023      antialiasing filter is either specified or either designed with a
4024      Kaiser-windowed sinecard.
4025
4026      Ref [1] J. G. Proakis and D. G. Manolakis, Digital Signal
4027      Processing: Principles, Algorithms, and Applications, 4th ed.,
4028      Prentice Hall, 2007. Chap. 6
4029
4030      Ref [2] A. V. Oppenheim, R. W. Schafer and J. R. Buck,
4031      Discrete-time signal processing, Signal processing series,
4032      Prentice-Hall, 1999
4033
4034
4035
4036
4037 # name: <cell-element>
4038 # type: sq_string
4039 # elements: 1
4040 # length: 47
4041 Change the sample rate of X by a factor of P/Q.
4042
4043
4044
4045 # name: <cell-element>
4046 # type: sq_string
4047 # elements: 1
4048 # length: 8
4049 residued
4050
4051
4052 # name: <cell-element>
4053 # type: sq_string
4054 # elements: 1
4055 # length: 1061
4056  -- Function File: [R, P, F, M] = residued (B, A)
4057      Compute the partial fraction expansion (PFE) of filter H(z) =
4058      B(z)/A(z).  In the usual PFE function `residuez', the IIR part
4059      (poles P and residues R) is driven _in parallel_ with the FIR part
4060      (F).  In this variant (`residued') the IIR part is driven by the
4061      _output_ of the FIR part.  This structure can be more accurate in
4062      signal modeling applications.
4063
4064      INPUTS: B and A are vectors specifying the digital filter H(z) =
4065      B(z)/A(z).  Say `help filter' for documentation of the B and A
4066      filter coefficients.
4067
4068      RETURNED:
4069         * R = column vector containing the filter-pole residues
4070         * P = column vector containing the filter poles
4071         * F = row vector containing the FIR part, if any
4072         * M = column vector of pole multiplicities
4073
4074      EXAMPLES:
4075             Say `test residued verbose' to see a number of examples.
4076
4077      For the theory of operation, see
4078      <http://ccrma.stanford.edu/~jos/filters/residued.html>
4079
4080      See also: residue residued
4081
4082
4083
4084
4085
4086 # name: <cell-element>
4087 # type: sq_string
4088 # elements: 1
4089 # length: 72
4090 Compute the partial fraction expansion (PFE) of filter H(z) = B(z)/A(z).
4091
4092
4093
4094 # name: <cell-element>
4095 # type: sq_string
4096 # elements: 1
4097 # length: 8
4098 residuez
4099
4100
4101 # name: <cell-element>
4102 # type: sq_string
4103 # elements: 1
4104 # length: 750
4105  -- Function File: [R, P, F, M] = residuez (B, A)
4106      Compute the partial fraction expansion of filter H(z) = B(z)/A(z).
4107
4108      INPUTS: B and A are vectors specifying the digital filter H(z) =
4109      B(z)/A(z).  Say `help filter' for documentation of the B and A
4110      filter coefficients.
4111
4112      RETURNED:
4113         * R = column vector containing the filter-pole residues
4114         * P = column vector containing the filter poles
4115         * F = row vector containing the FIR part, if any
4116         * M = column vector of pole multiplicities
4117
4118      EXAMPLES:
4119             Say `test residuez verbose' to see a number of examples.
4120
4121      For the theory of operation, see
4122      <http://ccrma.stanford.edu/~jos/filters/residuez.html>
4123
4124      See also: residue residued
4125
4126
4127
4128
4129
4130 # name: <cell-element>
4131 # type: sq_string
4132 # elements: 1
4133 # length: 66
4134 Compute the partial fraction expansion of filter H(z) = B(z)/A(z).
4135
4136
4137
4138 # name: <cell-element>
4139 # type: sq_string
4140 # elements: 1
4141 # length: 18
4142 sampled2continuous
4143
4144
4145 # name: <cell-element>
4146 # type: sq_string
4147 # elements: 1
4148 # length: 402
4149  Usage:
4150  
4151  xt = sampled2continuous( xn , T, t )
4152  
4153  Calculate the x(t) reconstructed
4154  from samples x[n] sampled at a rate 1/T samples
4155  per unit time.
4156  
4157  t is all the instants of time when you need x(t) 
4158  from x[n]; this time is relative to x[0] and not
4159  an absolute time.
4160  
4161  This function can be used to calculate sampling rate
4162  effects on aliasing, actual signal reconstruction
4163  from discrete samples.
4164
4165
4166
4167 # name: <cell-element>
4168 # type: sq_string
4169 # elements: 1
4170 # length: 80
4171  Usage:
4172  
4173  xt = sampled2continuous( xn , T, t )
4174  
4175  Calculate the x(t) reconstruc
4176
4177
4178
4179 # name: <cell-element>
4180 # type: sq_string
4181 # elements: 1
4182 # length: 8
4183 sawtooth
4184
4185
4186 # name: <cell-element>
4187 # type: sq_string
4188 # elements: 1
4189 # length: 664
4190  -- Function File: [Y] = sawtooth(T)
4191  -- Function File: [Y] = sawtooth(T,WIDTH)
4192      Generates a sawtooth wave of period `2 * pi' with limits `+1/-1'
4193      for the elements of T.
4194
4195      WIDTH is a real number between `0' and `1' which specifies the
4196      point between `0' and `2 * pi' where the maximum is. The function
4197      increases linearly from `-1' to `1' in  `[0, 2 * pi * WIDTH]'
4198      interval, and decreases linearly from `1' to `-1' in the interval
4199      `[2 * pi * WIDTH, 2 * pi]'.
4200
4201      If WIDTH is 0.5, the function generates a standard triangular wave.
4202
4203      If WIDTH is not specified, it takes a value of 1, which is a
4204      standard sawtooth function.
4205
4206
4207
4208
4209 # name: <cell-element>
4210 # type: sq_string
4211 # elements: 1
4212 # length: 80
4213 Generates a sawtooth wave of period `2 * pi' with limits `+1/-1'  for
4214 the elemen
4215
4216
4217
4218 # name: <cell-element>
4219 # type: sq_string
4220 # elements: 1
4221 # length: 7
4222 sftrans
4223
4224
4225 # name: <cell-element>
4226 # type: sq_string
4227 # elements: 1
4228 # length: 3640
4229  usage: [Sz, Sp, Sg] = sftrans(Sz, Sp, Sg, W, stop)
4230
4231  Transform band edges of a generic lowpass filter (cutoff at W=1)
4232  represented in splane zero-pole-gain form.  W is the edge of the
4233  target filter (or edges if band pass or band stop). Stop is true for
4234  high pass and band stop filters or false for low pass and band pass
4235  filters. Filter edges are specified in radians, from 0 to pi (the
4236  nyquist frequency).
4237
4238  Theory: Given a low pass filter represented by poles and zeros in the
4239  splane, you can convert it to a low pass, high pass, band pass or 
4240  band stop by transforming each of the poles and zeros individually.
4241  The following table summarizes the transformation:
4242
4243  Transform         Zero at x                  Pole at x
4244  ----------------  -------------------------  ------------------------
4245  Low Pass          zero: Fc x/C               pole: Fc x/C
4246  S -> C S/Fc       gain: C/Fc                 gain: Fc/C 
4247  ----------------  -------------------------  ------------------------
4248  High Pass         zero: Fc C/x               pole: Fc C/x
4249  S -> C Fc/S       pole: 0                    zero: 0
4250                    gain: -x                   gain: -1/x
4251  ----------------  -------------------------  ------------------------
4252  Band Pass         zero: b Â± sqrt(b^2-FhFl)   pole: b Â± sqrt(b^2-FhFl)
4253         S^2+FhFl   pole: 0                    zero: 0
4254  S -> C --------   gain: C/(Fh-Fl)            gain: (Fh-Fl)/C
4255         S(Fh-Fl)   b=x/C (Fh-Fl)/2            b=x/C (Fh-Fl)/2
4256  ----------------  -------------------------  ------------------------
4257  Band Stop         zero: b Â± sqrt(b^2-FhFl)   pole: b Â± sqrt(b^2-FhFl)
4258         S(Fh-Fl)   pole: Â±sqrt(-FhFl)         zero: Â±sqrt(-FhFl)
4259  S -> C --------   gain: -x                   gain: -1/x
4260         S^2+FhFl   b=C/x (Fh-Fl)/2            b=C/x (Fh-Fl)/2
4261  ----------------  -------------------------  ------------------------
4262  Bilinear          zero: (2+xT)/(2-xT)        pole: (2+xT)/(2-xT)
4263       2 z-1        pole: -1                   zero: -1
4264  S -> - ---        gain: (2-xT)/T             gain: (2-xT)/T
4265       T z+1
4266  ----------------  -------------------------  ------------------------
4267
4268  where C is the cutoff frequency of the initial lowpass filter, Fc is
4269  the edge of the target low/high pass filter and [Fl,Fh] are the edges
4270  of the target band pass/stop filter.  With abundant tedious algebra,
4271  you can derive the above formulae yourself by substituting the
4272  transform for S into H(S)=S-x for a zero at x or H(S)=1/(S-x) for a
4273  pole at x, and converting the result into the form:
4274
4275     H(S)=g prod(S-Xi)/prod(S-Xj)
4276
4277  The transforms are from the references.  The actual pole-zero-gain
4278  changes I derived myself.
4279
4280  Please note that a pole and a zero at the same place exactly cancel.
4281  This is significant for High Pass, Band Pass and Band Stop filters
4282  which create numerous extra poles and zeros, most of which cancel.
4283  Those which do not cancel have a "fill-in" effect, extending the 
4284  shorter of the sets to have the same number of as the longer of the
4285  sets of poles and zeros (or at least split the difference in the case
4286  of the band pass filter).  There may be other opportunistic
4287  cancellations but I will not check for them.
4288
4289  Also note that any pole on the unit circle or beyond will result in
4290  an unstable filter.  Because of cancellation, this will only happen
4291  if the number of poles is smaller than the number of zeros and the
4292  filter is high pass or band pass.  The analytic design methods all
4293  yield more poles than zeros, so this will not be a problem.
4294  
4295  References: 
4296
4297  Proakis & Manolakis (1992). Digital Signal Processing. New York:
4298  Macmillan Publishing Company.
4299
4300
4301
4302 # name: <cell-element>
4303 # type: sq_string
4304 # elements: 1
4305 # length: 52
4306  usage: [Sz, Sp, Sg] = sftrans(Sz, Sp, Sg, W, stop)
4307
4308
4309
4310
4311 # name: <cell-element>
4312 # type: sq_string
4313 # elements: 1
4314 # length: 6
4315 sgolay
4316
4317
4318 # name: <cell-element>
4319 # type: sq_string
4320 # elements: 1
4321 # length: 1079
4322  F = sgolay (p, n [, m [, ts]])
4323    Computes the filter coefficients for all Savitzsky-Golay smoothing
4324    filters of order p for length n (odd). m can be used in order to
4325    get directly the mth derivative. In this case, ts is a scaling factor. 
4326
4327  The early rows of F smooth based on future values and later rows
4328  smooth based on past values, with the middle row using half future
4329  and half past.  In particular, you can use row i to estimate x(k)
4330  based on the i-1 preceding values and the n-i following values of x
4331  values as y(k) = F(i,:) * x(k-i+1:k+n-i).
4332
4333  Normally, you would apply the first (n-1)/2 rows to the first k
4334  points of the vector, the last k rows to the last k points of the
4335  vector and middle row to the remainder, but for example if you were
4336  running on a realtime system where you wanted to smooth based on the
4337  all the data collected up to the current time, with a lag of five
4338  samples, you could apply just the filter on row n-5 to your window
4339  of length n each time you added a new sample.
4340
4341  Reference: Numerical recipes in C. p 650
4342
4343  See also: sgolayfilt
4344
4345
4346
4347 # name: <cell-element>
4348 # type: sq_string
4349 # elements: 1
4350 # length: 80
4351  F = sgolay (p, n [, m [, ts]])
4352    Computes the filter coefficients for all Savi
4353
4354
4355
4356 # name: <cell-element>
4357 # type: sq_string
4358 # elements: 1
4359 # length: 10
4360 sgolayfilt
4361
4362
4363 # name: <cell-element>
4364 # type: sq_string
4365 # elements: 1
4366 # length: 857
4367  y = sgolayfilt (x, p, n [, m [, ts]])
4368     Smooth the data in x with a Savitsky-Golay smoothing filter of
4369     polynomial order p and length n, n odd, n > p.  By default, p=3
4370     and n=p+2 or n=p+3 if p is even.
4371
4372  y = sgolayfilt (x, F)
4373     Smooth the data in x with smoothing filter F computed by sgolay.
4374
4375  These filters are particularly good at preserving lineshape while
4376  removing high frequency squiggles. Particularly, compare a 5 sample
4377  averager, an order 5 butterworth lowpass filter (cutoff 1/3) and
4378  sgolayfilt(x, 3, 5), the best cubic estimated from 5 points:
4379
4380     [b, a] = butter(5,1/3);
4381     x=[zeros(1,15), 10*ones(1,10), zeros(1,15)];
4382     plot(sgolayfilt(x),"r;sgolayfilt;",...
4383          filtfilt(ones(1,5)/5,1,x),"g;5 sample average;",...
4384          filtfilt(b,a,x),"c;order 5 butterworth;",...
4385          x,"+b;original data;");
4386
4387  See also: sgolay
4388
4389
4390
4391 # name: <cell-element>
4392 # type: sq_string
4393 # elements: 1
4394 # length: 80
4395  y = sgolayfilt (x, p, n [, m [, ts]])
4396     Smooth the data in x with a Savitsky-
4397
4398
4399
4400 # name: <cell-element>
4401 # type: sq_string
4402 # elements: 1
4403 # length: 8
4404 shanwavf
4405
4406
4407 # name: <cell-element>
4408 # type: sq_string
4409 # elements: 1
4410 # length: 97
4411  -- Function File: [PSI,X] = shanwavf (LB,UB,N,FB,FC)
4412      Compute the Complex Shannon wavelet.
4413
4414
4415
4416
4417 # name: <cell-element>
4418 # type: sq_string
4419 # elements: 1
4420 # length: 36
4421 Compute the Complex Shannon wavelet.
4422
4423
4424
4425 # name: <cell-element>
4426 # type: sq_string
4427 # elements: 1
4428 # length: 13
4429 sigmoid_train
4430
4431
4432 # name: <cell-element>
4433 # type: sq_string
4434 # elements: 1
4435 # length: 555
4436  -- Function File: Y = sigmoid_train(T, RANGES, RC)
4437      Evaluates a train of sigmoid functions at T.
4438
4439      The number and duration of each sigmoid is determined from RANGES.
4440      Each row of RANGES represents a real interval, e.g. if sigmod `i'
4441      starts at `t=0.1' and ends at `t=0.5', then `RANGES(i,:) = [0.1
4442      0.5]'.  The input RC is a array that defines the rising and
4443      falling time constants of each sigmoids. Its size must equal the
4444      size of RANGES.
4445
4446      Run `demo sigmoid_train' to some examples of the use of this
4447      function.
4448
4449
4450
4451
4452
4453 # name: <cell-element>
4454 # type: sq_string
4455 # elements: 1
4456 # length: 44
4457 Evaluates a train of sigmoid functions at T.
4458
4459
4460
4461 # name: <cell-element>
4462 # type: sq_string
4463 # elements: 1
4464 # length: 6
4465 sos2tf
4466
4467
4468 # name: <cell-element>
4469 # type: sq_string
4470 # elements: 1
4471 # length: 808
4472  -- Function File: [B, A] = sos2tf (SOS, BSCALE)
4473      Convert series second-order sections to direct form H(z) =
4474      B(z)/A(z).
4475
4476      INPUTS:
4477         * SOS = matrix of series second-order sections, one per row:
4478           SOS = [B1.' A1.'; ...; BN.' AN.'], where
4479           `B1.'==[b0 b1 b2] and A1.'==[1 a1 a2]' for section 1, etc.
4480           b0 must be nonzero for each section.
4481           See `filter()' for documentation of the second-order
4482           direct-form filter coefficients Bi and Ai.
4483
4484         * BSCALE is an overall gain factor that effectively scales the
4485           output B vector (or any one of the input Bi vectors).
4486
4487      RETURNED: B and A are vectors specifying the digital filter H(z) =
4488      B(z)/A(z).  See `filter()' for further details.
4489
4490      See also: tf2sos zp2sos sos2pz zp2tf tf2zp
4491
4492
4493
4494
4495
4496 # name: <cell-element>
4497 # type: sq_string
4498 # elements: 1
4499 # length: 69
4500 Convert series second-order sections to direct form H(z) = B(z)/A(z).
4501
4502
4503
4504 # name: <cell-element>
4505 # type: sq_string
4506 # elements: 1
4507 # length: 6
4508 sos2zp
4509
4510
4511 # name: <cell-element>
4512 # type: sq_string
4513 # elements: 1
4514 # length: 1009
4515  -- Function File: [Z, P, G] = sos2zp (SOS, BSCALE)
4516      Convert series second-order sections to zeros, poles, and gains
4517      (pole residues).
4518
4519      INPUTS:
4520         * SOS = matrix of series second-order sections, one per row:
4521           SOS = [B1.' A1.'; ...; BN.' AN.'], where
4522           `B1.'==[b0 b1 b2] and A1.'==[1 a1 a2]' for section 1, etc.
4523           b0 must be nonzero for each section.  See `filter()' for
4524           documentation of the second-order direct-form filter
4525           coefficients Bi and Ai.
4526
4527         * BSCALE is an overall gain factor that effectively scales any
4528           one of the input Bi vectors.
4529
4530      RETURNED:
4531         *   Z = column-vector containing all zeros (roots of B(z))
4532         *   P = column-vector containing all poles (roots of A(z))
4533         *   G = overall gain = B(Inf)
4534
4535      EXAMPLE:
4536             [z,p,g] = sos2zp([1 0 1, 1 0 -0.81; 1 0 0, 1 0 0.49])
4537             => z = [i; -i; 0; 0], p = [0.9, -0.9, 0.7i, -0.7i], g=1
4538
4539      See also: zp2sos sos2tf tf2sos zp2tf tf2zp
4540
4541
4542
4543
4544
4545 # name: <cell-element>
4546 # type: sq_string
4547 # elements: 1
4548 # length: 80
4549 Convert series second-order sections to zeros, poles, and gains (pole
4550 residues).
4551
4552
4553
4554 # name: <cell-element>
4555 # type: sq_string
4556 # elements: 1
4557 # length: 8
4558 specgram
4559
4560
4561 # name: <cell-element>
4562 # type: sq_string
4563 # elements: 1
4564 # length: 4570
4565  usage: [S [, f [, t]]] = specgram(x [, n [, Fs [, window [, overlap]]]])
4566
4567  Generate a spectrogram for the signal. This chops the signal into
4568  overlapping slices, windows each slice and applies a Fourier
4569  transform to determine the frequency components at that slice.
4570
4571  x: vector of samples
4572  n: size of fourier transform window, or [] for default=256
4573  Fs: sample rate, or [] for default=2 Hz
4574  window: shape of the fourier transform window, or [] for default=hanning(n)
4575     Note: window length can be specified instead, in which case
4576     window=hanning(length)
4577  overlap: overlap with previous window, or [] for default=length(window)/2
4578
4579  Return values
4580     S is complex output of the FFT, one row per slice
4581     f is the frequency indices corresponding to the rows of S.
4582     t is the time indices corresponding to the columns of S.
4583     If no return value is requested, the spectrogram is displayed instead.
4584
4585  Example
4586     x = chirp([0:0.001:2],0,2,500);  # freq. sweep from 0-500 over 2 sec.
4587     Fs=1000;                  # sampled every 0.001 sec so rate is 1 kHz
4588     step=ceil(20*Fs/1000);    # one spectral slice every 20 ms
4589     window=ceil(100*Fs/1000); # 100 ms data window
4590     specgram(x, 2^nextpow2(window), Fs, window, window-step);
4591
4592     ## Speech spectrogram
4593     [x, Fs] = auload(file_in_loadpath("sample.wav")); # audio file
4594     step = fix(5*Fs/1000);     # one spectral slice every 5 ms
4595     window = fix(40*Fs/1000);  # 40 ms data window
4596     fftn = 2^nextpow2(window); # next highest power of 2
4597     [S, f, t] = specgram(x, fftn, Fs, window, window-step);
4598     S = abs(S(2:fftn*4000/Fs,:)); # magnitude in range 0<f<=4000 Hz.
4599     S = S/max(S(:));           # normalize magnitude so that max is 0 dB.
4600     S = max(S, 10^(-40/10));   # clip below -40 dB.
4601     S = min(S, 10^(-3/10));    # clip above -3 dB.
4602     imagesc(t, f, flipud(log(S)));   # display in log scale
4603
4604  The choice of window defines the time-frequency resolution.  In
4605  speech for example, a wide window shows more harmonic detail while a
4606  narrow window averages over the harmonic detail and shows more
4607  formant structure. The shape of the window is not so critical so long
4608  as it goes gradually to zero on the ends.
4609
4610  Step size (which is window length minus overlap) controls the
4611  horizontal scale of the spectrogram. Decrease it to stretch, or
4612  increase it to compress. Increasing step size will reduce time
4613  resolution, but decreasing it will not improve it much beyond the
4614  limits imposed by the window size (you do gain a little bit,
4615  depending on the shape of your window, as the peak of the window
4616  slides over peaks in the signal energy).  The range 1-5 msec is good
4617  for speech.
4618
4619  FFT length controls the vertical scale.  Selecting an FFT length
4620  greater than the window length does not add any information to the
4621  spectrum, but it is a good way to interpolate between frequency
4622  points which can make for prettier spectrograms.
4623
4624  After you have generated the spectral slices, there are a number of
4625  decisions for displaying them.  First the phase information is
4626  discarded and the energy normalized:
4627
4628      S = abs(S); S = S/max(S(:));
4629
4630  Then the dynamic range of the signal is chosen.  Since information in
4631  speech is well above the noise floor, it makes sense to eliminate any
4632  dynamic range at the bottom end.  This is done by taking the max of
4633  the magnitude and some minimum energy such as minE=-40dB. Similarly,
4634  there is not much information in the very top of the range, so
4635  clipping to a maximum energy such as maxE=-3dB makes sense:
4636
4637      S = max(S, 10^(minE/10)); S = min(S, 10^(maxE/10));
4638
4639  The frequency range of the FFT is from 0 to the Nyquist frequency of
4640  one half the sampling rate.  If the signal of interest is band
4641  limited, you do not need to display the entire frequency range. In
4642  speech for example, most of the signal is below 4 kHz, so there is no
4643  reason to display up to the Nyquist frequency of 10 kHz for a 20 kHz
4644  sampling rate.  In this case you will want to keep only the first 40%
4645  of the rows of the returned S and f.  More generally, to display the
4646  frequency range [minF, maxF], you could use the following row index:
4647
4648      idx = (f >= minF & f <= maxF);
4649
4650  Then there is the choice of colormap.  A brightness varying colormap
4651  such as copper or bone gives good shape to the ridges and valleys. A
4652  hue varying colormap such as jet or hsv gives an indication of the
4653  steepness of the slopes.  The final spectrogram is displayed in log
4654  energy scale and by convention has low frequencies on the bottom of
4655  the image:
4656
4657      imagesc(t, f, flipud(log(S(idx,:))));
4658
4659
4660
4661 # name: <cell-element>
4662 # type: sq_string
4663 # elements: 1
4664 # length: 74
4665  usage: [S [, f [, t]]] = specgram(x [, n [, Fs [, window [, overlap]]]])
4666
4667
4668
4669
4670 # name: <cell-element>
4671 # type: sq_string
4672 # elements: 1
4673 # length: 6
4674 square
4675
4676
4677 # name: <cell-element>
4678 # type: sq_string
4679 # elements: 1
4680 # length: 379
4681  -- Function File: S = square(T, DUTY)
4682  -- Function File: S = square(T)
4683      Generate a square wave of period 2 pi with limits +1/-1.
4684
4685      If DUTY is specified, the square wave is +1 for that portion of
4686      the time.
4687
4688                          on time
4689         duty cycle = ------------------
4690                      on time + off time
4691
4692      See also: cos, sawtooth, sin, tripuls
4693
4694
4695
4696
4697
4698 # name: <cell-element>
4699 # type: sq_string
4700 # elements: 1
4701 # length: 56
4702 Generate a square wave of period 2 pi with limits +1/-1.
4703
4704
4705
4706 # name: <cell-element>
4707 # type: sq_string
4708 # elements: 1
4709 # length: 5
4710 ss2tf
4711
4712
4713 # name: <cell-element>
4714 # type: sq_string
4715 # elements: 1
4716 # length: 355
4717  -- Function File: [NUM, DEN] = ss2tf (A, B, C, D)
4718      Conversion from transfer function to state-space.  The state space
4719      system:
4720                 .
4721                 x = Ax + Bu
4722                 y = Cx + Du
4723
4724      is converted to a transfer function:
4725
4726                           num(s)
4727                     G(s)=-------
4728                           den(s)
4729
4730
4731
4732
4733
4734 # name: <cell-element>
4735 # type: sq_string
4736 # elements: 1
4737 # length: 49
4738 Conversion from transfer function to state-space.
4739
4740
4741
4742 # name: <cell-element>
4743 # type: sq_string
4744 # elements: 1
4745 # length: 5
4746 ss2zp
4747
4748
4749 # name: <cell-element>
4750 # type: sq_string
4751 # elements: 1
4752 # length: 172
4753  -- Function File: [POL, ZER, K] = ss2zp (A, B, C, D)
4754      Converts a state space representation to a set of poles and zeros;
4755      K is a gain associated with the zeros.
4756
4757
4758
4759
4760
4761 # name: <cell-element>
4762 # type: sq_string
4763 # elements: 1
4764 # length: 80
4765 Converts a state space representation to a set of poles and zeros; K is
4766 a gain a
4767
4768
4769
4770 # name: <cell-element>
4771 # type: sq_string
4772 # elements: 1
4773 # length: 6
4774 tf2sos
4775
4776
4777 # name: <cell-element>
4778 # type: sq_string
4779 # elements: 1
4780 # length: 1051
4781  -- Function File: [SOS, G] = tf2sos (B, A)
4782      Convert direct-form filter coefficients to series second-order
4783      sections.
4784
4785      INPUTS: B and A are vectors specifying the digital filter H(z) =
4786      B(z)/A(z).  See `filter()' for documentation of the B and A filter
4787      coefficients.
4788
4789      RETURNED: SOS = matrix of series second-order sections, one per
4790      row:
4791      SOS = [B1.' A1.'; ...; BN.' AN.'], where
4792      `B1.'==[b0 b1 b2] and A1.'==[1 a1 a2]' for section 1, etc.
4793      b0 must be nonzero for each section (zeros at infinity not
4794      supported).  BSCALE is an overall gain factor that effectively
4795      scales any one of the Bi vectors.
4796
4797      EXAMPLE:
4798           B=[1 0 0 0 0 1];
4799           A=[1 0 0 0 0 .9];
4800           [sos,g] = tf2sos(B,A)
4801
4802           sos =
4803
4804              1.00000   0.61803   1.00000   1.00000   0.60515   0.95873
4805              1.00000  -1.61803   1.00000   1.00000  -1.58430   0.95873
4806              1.00000   1.00000  -0.00000   1.00000   0.97915  -0.00000
4807
4808           g = 1
4809
4810      See also: sos2tf zp2sos sos2pz zp2tf tf2zp
4811
4812
4813
4814
4815
4816 # name: <cell-element>
4817 # type: sq_string
4818 # elements: 1
4819 # length: 72
4820 Convert direct-form filter coefficients to series second-order sections.
4821
4822
4823
4824 # name: <cell-element>
4825 # type: sq_string
4826 # elements: 1
4827 # length: 5
4828 tf2ss
4829
4830
4831 # name: <cell-element>
4832 # type: sq_string
4833 # elements: 1
4834 # length: 518
4835  -- Function File: [A, B, C, D] = tf2ss (NUM, DEN)
4836      Conversion from transfer function to state-space.  The state space
4837      system:
4838                 .
4839                 x = Ax + Bu
4840                 y = Cx + Du
4841      is obtained from a transfer function:
4842                           num(s)
4843                     G(s)=-------
4844                           den(s)
4845
4846      The state space system matrices obtained from this function will
4847      be in observable companion form as Wolovich's Observable Structure
4848      Theorem is used.
4849
4850
4851
4852
4853 # name: <cell-element>
4854 # type: sq_string
4855 # elements: 1
4856 # length: 49
4857 Conversion from transfer function to state-space.
4858
4859
4860
4861 # name: <cell-element>
4862 # type: sq_string
4863 # elements: 1
4864 # length: 5
4865 tf2zp
4866
4867
4868 # name: <cell-element>
4869 # type: sq_string
4870 # elements: 1
4871 # length: 241
4872  -- Function File: [ZER, POL, K] = tf2zp (NUM, DEN)
4873      Converts transfer functions to poles-and-zero representations.
4874
4875      Returns the zeros and poles of the system defined by NUM/DEN.  K
4876      is a gain associated with the system zeros.
4877
4878
4879
4880
4881 # name: <cell-element>
4882 # type: sq_string
4883 # elements: 1
4884 # length: 62
4885 Converts transfer functions to poles-and-zero representations.
4886
4887
4888
4889 # name: <cell-element>
4890 # type: sq_string
4891 # elements: 1
4892 # length: 3
4893 tfe
4894
4895
4896 # name: <cell-element>
4897 # type: sq_string
4898 # elements: 1
4899 # length: 381
4900  Usage:
4901    [Pxx,freq] = tfe(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
4902
4903      Estimate transfer function of system with input "x" and output "y".
4904      Use the Welch (1967) periodogram/FFT method.
4905      Compatible with Matlab R11 tfe and earlier.
4906      See "help pwelch" for description of arguments, hints and references
4907      --- especially hint (7) for Matlab R11 defaults.
4908
4909
4910
4911 # name: <cell-element>
4912 # type: sq_string
4913 # elements: 1
4914 # length: 80
4915  Usage:
4916    [Pxx,freq] = tfe(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
4917
4918
4919
4920
4921 # name: <cell-element>
4922 # type: sq_string
4923 # elements: 1
4924 # length: 10
4925 tfestimate
4926
4927
4928 # name: <cell-element>
4929 # type: sq_string
4930 # elements: 1
4931 # length: 284
4932  Usage:
4933    [Pxx,freq]=tfestimate(x,y,Nfft,Fs,window,overlap,range,plot_type,detrend)
4934
4935      Estimate transfer function of system with input "x" and output "y".
4936      Use the Welch (1967) periodogram/FFT method.
4937      See "help pwelch" for description of arguments, hints and references.
4938
4939
4940
4941 # name: <cell-element>
4942 # type: sq_string
4943 # elements: 1
4944 # length: 80
4945  Usage:
4946    [Pxx,freq]=tfestimate(x,y,Nfft,Fs,window,overlap,range,plot_type,detr
4947
4948
4949
4950 # name: <cell-element>
4951 # type: sq_string
4952 # elements: 1
4953 # length: 6
4954 triang
4955
4956
4957 # name: <cell-element>
4958 # type: sq_string
4959 # elements: 1
4960 # length: 277
4961  usage:  w = triang (L)
4962
4963  Returns the filter coefficients of a triangular window of length L.
4964  Unlike the bartlett window, triang does not go to zero at the edges
4965  of the window.  For odd L, triang(L) is equal to bartlett(L+2) except
4966  for the zeros at the edges of the window.
4967
4968
4969
4970 # name: <cell-element>
4971 # type: sq_string
4972 # elements: 1
4973 # length: 24
4974  usage:  w = triang (L)
4975
4976
4977
4978
4979 # name: <cell-element>
4980 # type: sq_string
4981 # elements: 1
4982 # length: 7
4983 tripuls
4984
4985
4986 # name: <cell-element>
4987 # type: sq_string
4988 # elements: 1
4989 # length: 629
4990  usage: y = tripuls(t, w, skew)
4991
4992  Generate a triangular pulse over the interval [-w/2,w/2), sampled at
4993  times t.  This is useful with the function pulstran for generating a
4994  series pulses.
4995
4996  skew is a value between -1 and 1, indicating the relative placement
4997  of the peak within the width.  -1 indicates that the peak should be
4998  at -w/2, and 1 indicates that the peak should be at w/2.
4999
5000  Example
5001    fs = 11025;  # arbitrary sample rate
5002    f0 = 100;    # pulse train sample rate
5003    w = 0.3/f0;  # pulse width 3/10th the distance between pulses
5004    auplot(pulstran(0:1/fs:4/f0, 0:1/f0:4/f0, 'tripuls', w), fs);
5005
5006  See also: pulstran
5007
5008
5009
5010 # name: <cell-element>
5011 # type: sq_string
5012 # elements: 1
5013 # length: 32
5014  usage: y = tripuls(t, w, skew)
5015
5016
5017
5018
5019 # name: <cell-element>
5020 # type: sq_string
5021 # elements: 1
5022 # length: 8
5023 tukeywin
5024
5025
5026 # name: <cell-element>
5027 # type: sq_string
5028 # elements: 1
5029 # length: 633
5030  -- Function File: W = tukeywin (L, R)
5031      Return the filter coefficients of a Tukey window (also known as the
5032      cosine-tapered window) of length L. R defines the ratio between
5033      the constant section and and the cosine section. It has to be
5034      between 0 and 1. The function returns a Hanning window for R egals
5035      0 and a full box for R egals 1. By default R is set to 1/2.
5036
5037      For a definition of the Tukey window, see e.g. Fredric J. Harris,
5038      "On the Use of Windows for Harmonic Analysis with the Discrete
5039      Fourier Transform, Proceedings of the IEEE", Vol. 66, No. 1,
5040      January 1978, Page 67, Equation 38.
5041
5042
5043
5044
5045 # name: <cell-element>
5046 # type: sq_string
5047 # elements: 1
5048 # length: 80
5049 Return the filter coefficients of a Tukey window (also known as the
5050 cosine-taper
5051
5052
5053
5054 # name: <cell-element>
5055 # type: sq_string
5056 # elements: 1
5057 # length: 8
5058 upsample
5059
5060
5061 # name: <cell-element>
5062 # type: sq_string
5063 # elements: 1
5064 # length: 372
5065  -- Function File: Y = upsample (X, N)
5066  -- Function File: Y = upsample (X, N, OFFSET)
5067      Upsample the signal, inserting n-1 zeros between every element.
5068
5069      If X is a matrix, upsample every column.
5070
5071      If OFFSET is specified, control the position of the inserted
5072      sample in the block of n zeros.
5073
5074      See also: decimate, downsample, interp, resample, upfirdn
5075
5076
5077
5078
5079
5080 # name: <cell-element>
5081 # type: sq_string
5082 # elements: 1
5083 # length: 63
5084 Upsample the signal, inserting n-1 zeros between every element.
5085
5086
5087
5088 # name: <cell-element>
5089 # type: sq_string
5090 # elements: 1
5091 # length: 8
5092 welchwin
5093
5094
5095 # name: <cell-element>
5096 # type: sq_string
5097 # elements: 1
5098 # length: 696
5099  -- Function File: [W] = welchwin(L,C)
5100      Returns a row vector containing a Welch window, given by
5101      W(n)=1-(n/N-1)^2,   n=[0,1, ... L-1].  Argument L is the length of
5102      the window.  Optional argument C specifies a "symmetric" window
5103      (the default), or a "periodic" window.
5104
5105      A symmetric window has zero at each end and maximum in the middle;
5106      L must be an integer larger than 2.  `if c=="symmetric", N=(L-1)/2'
5107
5108      A periodic window wraps around the cyclic interval [0,1, ... L-1],
5109      and is intended for use with the DFT  (functions fft(),
5110      periodogram() etc).  L must be an integer larger than 1.  `if
5111      c=="periodic", N=L/2'.
5112
5113      See also: blackman, kaiser
5114
5115
5116
5117
5118
5119 # name: <cell-element>
5120 # type: sq_string
5121 # elements: 1
5122 # length: 80
5123 Returns a row vector containing a Welch window, given by
5124 W(n)=1-(n/N-1)^2,   n=[
5125
5126
5127
5128 # name: <cell-element>
5129 # type: sq_string
5130 # elements: 1
5131 # length: 6
5132 window
5133
5134
5135 # name: <cell-element>
5136 # type: sq_string
5137 # elements: 1
5138 # length: 221
5139  -- Function File: W = window (F, N, OPTS)
5140      Create a N-point windowing from the function F. The function F can
5141      be for example `@blackman'. Any additional arguments OPT are
5142      passed to the windowing function.
5143
5144
5145
5146
5147 # name: <cell-element>
5148 # type: sq_string
5149 # elements: 1
5150 # length: 47
5151 Create a N-point windowing from the function F.
5152
5153
5154
5155 # name: <cell-element>
5156 # type: sq_string
5157 # elements: 1
5158 # length: 5
5159 wkeep
5160
5161
5162 # name: <cell-element>
5163 # type: sq_string
5164 # elements: 1
5165 # length: 127
5166  -- Function File: [Y] = wkeep(X,L,OPT)
5167      Extract the elements of x of size l from the center, the right or
5168      the left.
5169
5170
5171
5172
5173 # name: <cell-element>
5174 # type: sq_string
5175 # elements: 1
5176 # length: 75
5177 Extract the elements of x of size l from the center, the right or the
5178 left.
5179
5180
5181
5182 # name: <cell-element>
5183 # type: sq_string
5184 # elements: 1
5185 # length: 4
5186 wrev
5187
5188
5189 # name: <cell-element>
5190 # type: sq_string
5191 # elements: 1
5192 # length: 121
5193  -- Function File: [Y] = wrev(X)
5194      Reverse the order of the element of the vector x.
5195
5196      See also: flipud, fliplr
5197
5198
5199
5200
5201
5202 # name: <cell-element>
5203 # type: sq_string
5204 # elements: 1
5205 # length: 49
5206 Reverse the order of the element of the vector x.
5207
5208
5209
5210 # name: <cell-element>
5211 # type: sq_string
5212 # elements: 1
5213 # length: 5
5214 xcorr
5215
5216
5217 # name: <cell-element>
5218 # type: sq_string
5219 # elements: 1
5220 # length: 2493
5221  usage: [R, lag] = xcorr (X [, Y] [, maxlag] [, scale])
5222
5223  Estimate the cross correlation R_xy(k) of vector arguments X and Y
5224  or, if Y is omitted, estimate autocorrelation R_xx(k) of vector X,
5225  for a range of lags k specified by  argument "maxlag".  If X is a
5226  matrix, each column of X is correlated with itself and every other
5227  column.
5228
5229  The cross-correlation estimate between vectors "x" and "y" (of
5230  length N) for lag "k" is given by 
5231     R_xy(k) = sum_{i=1}^{N}{x_{i+k} conj(y_i),
5232  where data not provided (for example x(-1), y(N+1)) is zero.
5233
5234  ARGUMENTS
5235   X       [non-empty; real or complex; vector or matrix] data
5236
5237   Y       [real or complex vector] data
5238           If X is a matrix (not a vector), Y must be omitted.
5239           Y may be omitted if X is a vector; in this case xcorr
5240           estimates the autocorrelation of X.
5241
5242   maxlag  [integer scalar] maximum correlation lag
5243           If omitted, the default value is N-1, where N is the
5244           greater of the lengths of X and Y or, if X is a matrix,
5245           the number of rows in X.
5246
5247   scale   [character string] specifies the type of scaling applied
5248           to the correlation vector (or matrix). is one of:
5249     'none'      return the unscaled correlation, R,
5250     'biased'    return the biased average, R/N, 
5251     'unbiased'  return the unbiassed average, R(k)/(N-|k|), 
5252     'coeff'     return the correlation coefficient, R/(rms(x).rms(y)),
5253           where "k" is the lag, and "N" is the length of X.
5254           If omitted, the default value is "none".
5255           If Y is supplied but does not have the ame length as X,
5256           scale must be "none".
5257           
5258  RETURNED VARIABLES
5259   R       array of correlation estimates
5260   lag     row vector of correlation lags [-maxlag:maxlag]
5261
5262   The array of correlation estimates has one of the following forms.
5263     (1) Cross-correlation estimate if X and Y are vectors.
5264     (2) Autocorrelation estimate if is a vector and Y is omitted,
5265     (3) If X is a matrix, R is an matrix containing the cross-
5266         correlation estimate of each column with every other column.
5267         Lag varies with the first index so that R has 2*maxlag+1
5268         rows and P^2 columns where P is the number of columns in X.
5269         If Rij(k) is the correlation between columns i and j of X
5270              R(k+maxlag+1,P*(i-1)+j) == Rij(k)
5271         for lag k in [-maxlag:maxlag], or
5272              R(:,P*(i-1)+j) == xcorr(X(:,i),X(:,j)).
5273         "reshape(R(k,:),P,P)" is the cross-correlation matrix for X(k,:).
5274
5275
5276
5277
5278 # name: <cell-element>
5279 # type: sq_string
5280 # elements: 1
5281 # length: 56
5282  usage: [R, lag] = xcorr (X [, Y] [, maxlag] [, scale])
5283
5284
5285
5286
5287 # name: <cell-element>
5288 # type: sq_string
5289 # elements: 1
5290 # length: 6
5291 xcorr2
5292
5293
5294 # name: <cell-element>
5295 # type: sq_string
5296 # elements: 1
5297 # length: 1046
5298  -- Function File: C = xcorr2 (A)
5299  -- Function File: C = xcorr2 (A, B)
5300  -- Function File: C = xcorr2 (..., SCALE)
5301      Compute the 2D cross-correlation of matrices A and B.
5302
5303      If B is not specified, it defaults to the same matrix as A, i.e.,
5304      it's the same as `xcorr(A, A)'.
5305
5306      The optional argument SCALE, defines the type of scaling applied
5307      to the cross-correlation matrix (defaults to "none"). Possible
5308      values are:
5309         * "biased"
5310
5311           Scales the raw cross-correlation by the maximum number of
5312           elements of A and B involved in the generation of any element
5313           of C.
5314
5315         * "unbiased"
5316
5317           Scales the raw correlation by dividing each element in the
5318           cross-correlation matrix by the number of products A and B
5319           used to generate that element
5320
5321         * "coeff"
5322
5323           Normalizes the sequence so that the largest cross-correlation
5324           element is identically 1.0.
5325
5326         * "none"
5327
5328           No scaling (this is the default).
5329
5330      See also: conv2, corr2, xcorr
5331
5332
5333
5334
5335
5336 # name: <cell-element>
5337 # type: sq_string
5338 # elements: 1
5339 # length: 53
5340 Compute the 2D cross-correlation of matrices A and B.
5341
5342
5343
5344 # name: <cell-element>
5345 # type: sq_string
5346 # elements: 1
5347 # length: 4
5348 xcov
5349
5350
5351 # name: <cell-element>
5352 # type: sq_string
5353 # elements: 1
5354 # length: 630
5355  usage: [c, lag] = xcov (X [, Y] [, maxlag] [, scale])
5356
5357  Compute covariance at various lags [=correlation(x-mean(x),y-mean(y))].
5358
5359  X: input vector
5360  Y: if specified, compute cross-covariance between X and Y,
5361  otherwise compute autocovariance of X.
5362  maxlag: is specified, use lag range [-maxlag:maxlag], 
5363  otherwise use range [-n+1:n-1].
5364  Scale:
5365     'biased'   for covariance=raw/N, 
5366     'unbiased' for covariance=raw/(N-|lag|), 
5367     'coeff'    for covariance=raw/(covariance at lag 0),
5368     'none'     for covariance=raw
5369  'none' is the default.
5370
5371  Returns the covariance for each lag in the range, plus an 
5372  optional vector of lags.
5373
5374
5375
5376 # name: <cell-element>
5377 # type: sq_string
5378 # elements: 1
5379 # length: 55
5380  usage: [c, lag] = xcov (X [, Y] [, maxlag] [, scale])
5381
5382
5383
5384
5385 # name: <cell-element>
5386 # type: sq_string
5387 # elements: 1
5388 # length: 12
5389 zerocrossing
5390
5391
5392 # name: <cell-element>
5393 # type: sq_string
5394 # elements: 1
5395 # length: 186
5396  -- Function File: X0 = zerocrossing (X, Y)
5397      Estimates the points at which a given waveform y=y(x) crosses the
5398      x-axis using linear interpolation.
5399
5400      See also: fzero, roots
5401
5402
5403
5404
5405
5406 # name: <cell-element>
5407 # type: sq_string
5408 # elements: 1
5409 # length: 80
5410 Estimates the points at which a given waveform y=y(x) crosses the
5411 x-axis using l
5412
5413
5414
5415 # name: <cell-element>
5416 # type: sq_string
5417 # elements: 1
5418 # length: 6
5419 zp2sos
5420
5421
5422 # name: <cell-element>
5423 # type: sq_string
5424 # elements: 1
5425 # length: 1179
5426  -- Function File: [SOS, G] = zp2sos (Z, P)
5427      Convert filter poles and zeros to second-order sections.
5428
5429      INPUTS:
5430         *   Z = column-vector containing the filter zeros
5431         *   P = column-vector containing the filter poles
5432         *   G = overall filter gain factor
5433
5434      RETURNED:
5435         * SOS = matrix of series second-order sections, one per row:
5436           SOS = [B1.' A1.'; ...; BN.' AN.'], where
5437           `B1.'==[b0 b1 b2] and A1.'==[1 a1 a2]' for section 1, etc.
5438           b0 must be nonzero for each section.
5439           See `filter()' for documentation of the second-order
5440           direct-form filter coefficients Bi and %Ai, i=1:N.
5441
5442         * BSCALE is an overall gain factor that effectively scales any
5443           one of the Bi vectors.
5444
5445      EXAMPLE:
5446             [z,p,g] = tf2zp([1 0 0 0 0 1],[1 0 0 0 0 .9]);
5447             [sos,g] = zp2sos(z,p,g)
5448
5449           sos =
5450              1.0000    0.6180    1.0000    1.0000    0.6051    0.9587
5451              1.0000   -1.6180    1.0000    1.0000   -1.5843    0.9587
5452              1.0000    1.0000         0    1.0000    0.9791         0
5453
5454           g =
5455               1
5456
5457      See also: sos2pz sos2tf tf2sos zp2tf tf2zp
5458
5459
5460
5461
5462
5463 # name: <cell-element>
5464 # type: sq_string
5465 # elements: 1
5466 # length: 56
5467 Convert filter poles and zeros to second-order sections.
5468
5469
5470
5471 # name: <cell-element>
5472 # type: sq_string
5473 # elements: 1
5474 # length: 5
5475 zp2ss
5476
5477
5478 # name: <cell-element>
5479 # type: sq_string
5480 # elements: 1
5481 # length: 556
5482  -- Function File: [A, B, C, D] = zp2ss (ZER, POL, K)
5483      Conversion from zero / pole to state space.
5484
5485      *Inputs*
5486     ZER
5487     POL
5488           Vectors of (possibly) complex poles and zeros of a transfer
5489           function. Complex values must come in conjugate pairs (i.e.,
5490           x+jy in ZER means that x-jy is also in ZER).
5491
5492     K
5493           Real scalar (leading coefficient).
5494
5495      *Outputs*
5496     A
5497     B
5498     C
5499     D
5500           The state space system, in the form:
5501                     .
5502                     x = Ax + Bu
5503                     y = Cx + Du
5504
5505
5506
5507
5508 # name: <cell-element>
5509 # type: sq_string
5510 # elements: 1
5511 # length: 43
5512 Conversion from zero / pole to state space.
5513
5514
5515
5516 # name: <cell-element>
5517 # type: sq_string
5518 # elements: 1
5519 # length: 5
5520 zp2tf
5521
5522
5523 # name: <cell-element>
5524 # type: sq_string
5525 # elements: 1
5526 # length: 326
5527  -- Function File: [NUM, DEN] = zp2tf (ZER, POL, K)
5528      Converts zeros / poles to a transfer function.
5529
5530      *Inputs*
5531     ZER
5532     POL
5533           Vectors of (possibly complex) poles and zeros of a transfer
5534           function.  Complex values must appear in conjugate pairs.
5535
5536     K
5537           Real scalar (leading coefficient).
5538
5539
5540
5541
5542 # name: <cell-element>
5543 # type: sq_string
5544 # elements: 1
5545 # length: 46
5546 Converts zeros / poles to a transfer function.
5547
5548
5549
5550 # name: <cell-element>
5551 # type: sq_string
5552 # elements: 1
5553 # length: 6
5554 zplane
5555
5556
5557 # name: <cell-element>
5558 # type: sq_string
5559 # elements: 1
5560 # length: 1223
5561  usage: zplane(b [, a]) or zplane(z [, p])
5562
5563  Plot the poles and zeros.  If the arguments are row vectors then they
5564  represent filter coefficients (numerator polynomial b and denominator
5565  polynomial a), but if they are column vectors or matrices then they
5566  represent poles and zeros.
5567
5568  This is a horrid interface, but I didn't choose it; better would be
5569  to accept b,a or z,p,g like other functions.  The saving grace is
5570  that poly(x) always returns a row vector and roots(x) always returns
5571  a column vector, so it is usually right.  You must only be careful
5572  when you are creating filters by hand.
5573
5574  Note that due to the nature of the roots() function, poles and zeros
5575  may be displayed as occurring around a circle rather than at a single
5576  point.
5577
5578  The transfer function is
5579                          
5580         B(z)   b0 + b1 z^(-1) + b2 z^(-2) + ... + bM z^(-M)
5581  H(z) = ---- = --------------------------------------------
5582         A(z)   a0 + a1 z^(-1) + a2 z^(-2) + ... + aN z^(-N)
5583
5584                b0          (z - z1) (z - z2) ... (z - zM)
5585              = -- z^(-M+N) ------------------------------
5586                a0          (z - p1) (z - p2) ... (z - pN)
5587
5588  The denominator a defaults to 1, and the poles p defaults to [].
5589
5590
5591
5592 # name: <cell-element>
5593 # type: sq_string
5594 # elements: 1
5595 # length: 43
5596  usage: zplane(b [, a]) or zplane(z [, p])
5597
5598
5599
5600
5601
5602