Bessel Filter Issues

So, I haven't been sleeping, so I think that this is going to be a very simple fix...

I've built the m-file, as follows, in order to calculate bessel function coefficients:
n=[0:20]; %length or order
i=0; %initialize counter
a=zeros(0,20); %initialize buffer for s coefficients

if i<= length(n)
t1=factorial((2*length(n)-1)-i); %calculate num
t2=(2^(length(n)-i)) * factorial(i) * factorial(length(n)-i); %calculate den
a(i) = t1/t2; %a=num/den
disp('What the crap, man?')[/size][/color]
The problem is that when I run the code, I get the following error:
??? Attempted to access a(0); index must be a positive integer or logical.

Error in ==> besseltest at 8
a(i) = t1/t2; %a=num/den

The bessel function can be found on the bessel filter page of wikipedia.
NOTE: I tried the built in bessel filter commands, but transforming them from the 's' domain to 'z' domain proved to be problematic, and gave me a [color=Purple]RCOND=some[/color] value error.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!