What is wrong with the code? I am getting an error as ' Input should be vector ' ?? I have a second order polynomial of omega were the coefficients are 32x32 matrices. I have written two codes for the same.both with errors.

2 vues (au cours des 30 derniers jours)
m1=zeros(24,8); m2=zeros(8,24); m3=zeros(8,8); M=[Mxx m1;m2 m3]; D1=zeros(24,24); D2=zeros(24,8); D=[D1 D2 ; Dtx Dtt]; k1=zeros(8,24); k=[Kxx -Kxt; k1 Ktt]; i=sqrt(-1); syms omega %code1: a=-1.*M; b=i.*D; c=k; p=[a b c]; omega=roots(p); %code2 % eqn= -(omega^2).*M+(i*omega).*D+k; % omega=solve(eqn==0,omega,'ReturnConditions', true);
  1 commentaire
John D'Errico
John D'Errico le 31 Mai 2016
Please learn to format your posted code so it is readable. Learn to use the "{} Code" button.

Connectez-vous pour commenter.

Réponses (1)

John D'Errico
John D'Errico le 31 Mai 2016
It would help if you actually reported the ENTIRE error message. Without that, I will only guess.
Does roots handle problems with entire matrices of coefficients? No. Roots will tell you something to the effect that the input argument should be a vector.
Use a loop if you have entire sets of problems to solve.

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by