Bessel Filter Issues - Programmers Heaven

#### Howdy, Stranger!

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

#### Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# Bessel Filter Issues

Posts: 1Member
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:
[size=2][color=Blue]
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
i=i+1;
end
disp('What the crap, man?')[/size][/color]
The problem is that when I run the code, I get the following error:
[color=Red]
??? 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
[/color]

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.