I have two n*n-sized matrix, Y is a constant tri-diagonal matrix,

where all the elements in Y is known and constant.

D is a diagoanl matrix,

where only d is unknown, the other numbers are known (e_n, f_n are known)

I want to find the complex value of d that can satisfy det (D-Y)=0.

Here is what I did:

- I define a matrix Y (20*20)
- I define d is a symbolic value: syms d
- I define D is a symbolic matrix : sym('D', [20 20]), with symbolic value d
- I define K=det(D-Y);
- I solve p=double(solve(K,d))

It can be solved if the matrix size is small, for example 5*5, but if the matrix size is large, for example 20*20, it is super slow.

I guess the reason is that, there is square roots expressions in matrix D which makes the determinant K cannot be expressed as a polymonid of d.

Is there any good method to solve fastly? Thanks for help!

## Best Answer