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 ExchangeRandom 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