summaryrefslogtreecommitdiff
path: root/modules/signal_processing/macros/zpbutt.sci
blob: 65c9af9c186d767b190865f6662d06a8e15741dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - F.D
// Copyright (C) INRIA - 1996 - C. Bunks
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt

function [pols,gain]=zpbutt(n,omegac)
    //<pols,gain>=zpbutt(n,omegac)
    //Computes the poles of a Butterworth analog
    //filter of order n and cutoff frequency omegac
    //transfer function H(s) is calculated by
    //     H(s) = gain/real(poly(pols,'s'))
    //  n      :Filter order
    //  omegac :Cut-off frequency in Hertz rd/s
    //  pols   :Resulting poles of filter
    //  gain   :Resulting gain of filter
    //
    //!
    angles=ones(1,n)*(%pi/2+%pi/(2*n))+(0:n-1)*%pi/n;
    pols=omegac*exp(%i*angles);
    gain=abs((-omegac)^n);
endfunction