www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/QuadraticEigenvalueProblemExample.m

    %% Quadratic Eigenvalue Problem with Mass, Damping, and Stiffness Matrices
% Solve a quadratic eigenvalue problem involving a mass matrix |M|, damping
% matrix |C|, and stiffness matrix |K|. This quadratic eigenvalue problem
% arises from the equation of motion:
%
% $$M \frac{d^2 y}{dt^2} + C \frac{dy}{dt} + Ky = f(t)$$
% 
% This equation applies to a broad range of oscillating systems, including
% a dynamic mass-spring system or RLC electronic network. The fundamental
% solution is $y(t) = x e^{\lambda t}$, so both $\lambda$ and |x| must
% solve the quadratic eigenvalue problem (QEP),
%
% $$\left( M \lambda^2 + C \lambda + K \right) x = 0$$
%
% Create coefficient matrices |M|, |C|, and |K| to represent a mass-spring
% system with four-degrees-of-freedom. The coefficient matrices are all
% symmetric and positive semidefinite, and |M| is a diagonal matrix.

% Copyright 2015 The MathWorks, Inc.

M = diag([3 1 3 1])
C = [0.4 0 -0.3 0; 0 0 0 0; -0.3 0 0.5 -0.2; 0 0 -0.2 0.2]
K = [-7 2 4  0; 2 -4 2 0; 4 2 -9 3; 0 0 3 -3]

%%
% Solve the QEP for the eigenvalues, eigenvectors, and condition numbers
% using |polyeig|. 
[X,e,s] = polyeig(K,C,M)

%%
% Check that the first eigenvalue, |e(1)|, and first eigenvector, |X(:,1)|,
% satisfy the QEP equation. The result is close to, but not exactly, zero.
lambda = e(1);
x = X(:,1);
(M*lambda^2 + C*lambda + K)*x