diff options
Diffstat (limited to 'macros/besselap.sci')
-rw-r--r-- | macros/besselap.sci | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/macros/besselap.sci b/macros/besselap.sci index 2ed0047..1e7d952 100644 --- a/macros/besselap.sci +++ b/macros/besselap.sci @@ -1,17 +1,14 @@ // 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 +// Modifieded by: Abinash Singh Under FOSSEE Internship +// Date of Modification: 3 Feb 2024 // Organization: FOSSEE, IIT Bombay // Email: toolbox@scilab.in - - function [zero, pole, gain]=besselap(n) //Bessel analog filter prototype. @@ -44,38 +41,44 @@ function [zero, pole, gain]=besselap(n) // zero = // // [] - + // Dependencies + // prepad 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); + px=prepad(px,max(length(px),length(py))); 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 + +/* +Note : The function is tested with Octave's outputs as a reference. +# all passed +[zero, pole, gain] = besselap (1) +[zero, pole, gain] = besselap (2) +[zero, pole, gain] = besselap (7) +[zero, pole, gain] = besselap (13) +[zero, pole, gain] = besselap (43) + +*/
\ No newline at end of file |