Eigen values of a Toeplitz Matrix

Hello. I have a problem finding the eig(T), my matrix have very very small numbers, my code is:
K=[];
M= [];
for i=0:512
M =[M,((-1)^(i))*combinatorio(3/4,i)]; %combinatorio is a function that i created to compute nchoosek(a,b) in real numbers
end
for i=0:512
if i==0
K=[K,((-1)^(i))*combinatorio(3/4,0)];
end
if i==1
K=[K,33];
end
if i >1
K = [K,0];
end
end
T=toeplitz (M,K);
E=eig(T)
When I do this for 512, it generates an error
Error using eig
Input matrix contains NaN or Inf.
I think that is becouse the values of the matrix are so small that MatLab thinks they are 0's. and have problems in eig(T), if you have an idea to solve this please help me with this. Thanks.
EDIT:
function [y1] = combinatorio(a,b)
c=a;
if b==0
y1=1;
end
if b~=0
for i=1:(b-1)
a=a*(c-i);
end
y1 = (a/factorial(b));
end

댓글 수: 2

Walter Roberson
Walter Roberson 2018년 5월 20일
It would help ifwe had your routine combinatorio
Juan Rodriguez
Juan Rodriguez 2018년 5월 20일
I edit it with that code.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2018년 5월 20일

0 개 추천

Your combinatorio finds (-1)^b*gamma(b-a)/gamma(-a) and then finds b! and divides the 2. But at b = 171, b! overflows representable doubles, resulting in inf.
You should reformulate so that in the loop you multiply a by (c-i)/(b+D) where D is -1, 0, or +1, depending on what you need for the factorial logic to work out.

카테고리

도움말 센터File Exchange에서 Random Number Generation에 대해 자세히 알아보기

질문:

2018년 5월 20일

답변:

2018년 5월 20일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by