My eig function worked once and then broke
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Benjamin KOENIG
el 20 de Abr. de 2022
Comentada: Christine Tobler
el 20 de Abr. de 2022
Hello everyone,
I am currently trying to solve a vibrant system, and I need its eigenvalues and eigenvectors. I so used the eig() function, as following:
[EigVec, EigVal] = eig(K\M, 'vector') % K the stiffness matrix, M the mass matrix
I tried it once and got the exact right results. I modified some values in the mass matrix and now this line isn't working anymore. I get the following error:
Error using sym/eig
Too many input arguments.
Error in Homework2 (line 347)
[EigVect, EigVal] = eig(K\M, 'vector');
I also tried:
[EigVec, EigVal] = eig(K\M)
And now I get absurd values.
Any ideas of what happened?
1 comentario
Christine Tobler
el 20 de Abr. de 2022
It sounds like originally your matrices didn't contain symbolic variables, so the eig command accepted the 'vector' option (eig for symbolic variables doesn't accept any option strings). Then you changed M so that it's now a symbolic variable - and those have quite different behavior, since it's not numerical calculation anymore but symbolic.
Can't really tell more since I don't know what you mean by absurd values, or what you expect in terms of symbolic calculation (for example, is M a specific number just in stored symbolically, or does it contain symbolic unknowns)?
We really need reproduction steps of what K and M are, and what you're hoping to compute, to help any more.
Respuesta aceptada
Bruno Luong
el 20 de Abr. de 2022
Don't use symbolic variable to build your matrices.
2 comentarios
Bruno Luong
el 20 de Abr. de 2022
Editada: Bruno Luong
el 20 de Abr. de 2022
"Error using sym/eig"
implies you have symbolic variable.
If
eig(K\M)
returns "absurd" result perhaps your matrices input is not correct ("I modified some values in the mass matrix" but what?) . But you don't tell us what ther are and why it is absurd. The only absurd thing to me is that you expect useful help from so little information.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!