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

Bessel Filter Issues

rwilli25rwilli25 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.
Sign In or Register to comment.