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 次查看(过去 30 天)
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 个)

John D'Errico
John D'Errico 2016-5-31
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.

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by