1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
// Copyright (C) 2018 - IIT Bombay - FOSSEE
//
// 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-en.txt
// Original contribution: FOSSEE, IIT Bombay
// Original Source : https://octave.sourceforge.io/signal/
// Modifieded by: Sonu Sharma, RGIT Mumbai
// Organization: FOSSEE, IIT Bombay
// Email: toolbox@scilab.in
function [zero, pole, gain]=besselap(n)
//Bessel analog filter prototype.
//Calling Sequence
//[zero, pole, gain] = besselap(n)
//zero = besselap(n)
//Parameters
//n: Filter Order
//zero: Zeros
//pole: Poles
//gain: Gain
//Description
//It Return bessel analog filter prototype of nth order.
//Examples
//[zero, pole, gain] = besselap (5)
//Output :
// gain =
//
// 1.
// pole =
//
// - 0.5905759 + 0.9072068i
// - 0.5905759 - 0.9072068i
// - 0.9264421
// - 0.8515536 + 0.4427175i
// - 0.8515536 - 0.4427175i
// zero =
//
// []
funcprot(0);
[nargout, nargin] = argn() ;
if (nargin>1 | nargin<1)
error("besselap : wrong number of input argument")
end
// interpret the input parameters
if (~(length(n)==1 & n == round(n) & n > 0))
error ("besselap: filter order n must be a positive integer");
end
p0=1;
p1=[1 1];
for nn=2:n
px=(2*nn-1)*p1;
py=[p0 0 0];
px=prepad(px,max(length(px),length(py)),0);
py=prepad(py,length(px));
p0=p1;
p1=px+py;
end
// p1 now contains the reverse bessel polynomial for n
// scale it by replacing s->s/w0 so that the gain becomes 1
p1=p1.*p1(length(p1)).^((length(p1)-1:-1:0)/(length(p1)-1));
zero=[];
pole=roots(p1);
gain=1;
endfunction
|