How to find a complex root from the determinate of a matrix?

2 visualizaciones (últimos 30 días)
shane
shane el 7 de Feb. de 2012
Editada: Alex el 4 de Oct. de 2013
Hi everyone,
Im having a trouble that can be described into two steps:
1)Im having a square complex matrix with unknown x.
2)I need to find x such that the determine of the matrix is zero.
Im trying to separate the solution into real and imag part and solve:
Function detM = detMcal(x,a,delta,L)
complexX = complex(x(1:2:end), x(2:2:end));
complexY = det(Matrix(x,a,delta,L))
detM = [real(complexY); imag(complexY)];
end
and
x = fsolve(@(x) detMcal(x,a,delta,L),[1,1]);
solution = complex(x(1:2:end), x(2:2:end))
But the program is not working. Is my code wrong or are there any better method?
Many Thanks.

Respuestas (2)

Dr. Seis
Dr. Seis el 8 de Feb. de 2012
Here is another example:
>>a = complex(randn(1),randn(1));
b = complex(randn(1),randn(1));
c = complex(randn(1),randn(1));
d = complex(randn(1),randn(1));
e = complex(randn(1),randn(1));
f = complex(randn(1),randn(1));
g = complex(randn(1),randn(1));
i = complex(randn(1),randn(1));
>> x = fsolve(@(x)det([a,b,c;d,e,f;g,x,i]),0)
Optimization terminated: first-order optimality is less than options.TolFun.
x =
-2.1461 - 1.9256i
>> M = [a b c; d e f; g x i];
>> det(M)
ans =
2.4603e-08 - 2.9054e-09i
>> x = (g*(b*f-c*e) + i*(a*e-b*d))/(a*f-d*c)
x =
-2.1461 - 1.9256i
>> M = [a b c; d e f; g x i];
>> det(M)
ans =
-1.0025e-15 - 5.6272e-16i
Clearly, the version that does not use "fsolve" is giving an answer that is closer to 0. However, setting the "TolFun" to something different will allow "fsolve" to run more iterations and converge to a more optimal solution. Obviously you wouldn't actually have to define "a" through "i" and construct a matrix as I did above, you would just define the matrix with all of its complex values and then stick an "x" for the element you want to solve for. Or are you planning on reading in these values from another source?
  3 comentarios
shane
shane el 8 de Feb. de 2012
By the way, is this similar the method you did or it will give a different solution:
Beta_real = fzero('detMcal_Real',stBeta1,[],a,delta,L)
Beta_Imag = fzero('detMcal_Imag',stBeta2,[],a,delta,L)
bta = complex(Beta_real,Beta_Imag)
%%%where function detMcal_Real and detMcal_Imag find the real and imaginary part of the determinate respectively.
Dr. Seis
Dr. Seis el 8 de Feb. de 2012
"fzero" will probably work, but is designed more for a different application. As far as what the error is, can you provide an example of what "bta", "a", "delta", "L" and/or the result of "Matrix(bta,a,delta,L)" would be?
I guess I am unsure of what you are doing when you break up the problem into real and imaginary parts since if you had a complex matrix "A", then det(A) does not necessarily equal det(real(A)) + i*det(imag(A))

Iniciar sesión para comentar.


Dr. Seis
Dr. Seis el 7 de Feb. de 2012
You are trying to do the following, but for almost any MxM matrix and any location of x within that matrix:
Example:
M = [a b c; d e f; g x i];
We need -
0 = det(M) = g*(b*f-c*e) - x*(a*f-d*c) + i*(a*e-b*d)
Done at the command line -
>> a = complex(randn(1),randn(1));
>> b = complex(randn(1),randn(1));
>> c = complex(randn(1),randn(1));
>> d = complex(randn(1),randn(1));
>> e = complex(randn(1),randn(1));
>> f = complex(randn(1),randn(1));
>> g = complex(randn(1),randn(1));
>> i = complex(randn(1),randn(1));
>> x = (g*(b*f-c*e) + i*(a*e-b*d))/(a*f-d*c);
>> M = [a b c; d e f; g x i]
M =
2.7694 + 0.1576i 3.0349 + 0.9572i -0.0631 + 0.8003i
-0.2050 + 0.4218i 1.4897 + 0.7922i 1.4172 + 0.6557i
-1.2075 + 0.8491i 0.6899 + 1.2400i 1.6302 + 0.6787i
>> det(M)
ans =
3.3931e-15 - 3.7396e-16i
  2 comentarios
Dr. Seis
Dr. Seis el 7 de Feb. de 2012
I just want to confirm before I look into this further.
shane
shane el 8 de Feb. de 2012
Hi Grant,
Thanks for the reply.
I forget to mention that the matrix is dynamics. It can be 8X8 12X12 or even bigger which is depended on user input.
Is there a certain way to find equation for x?
Many Thanks.

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by