File mttroot/mtt/lib/control/PPP/damped_matrix.m artifact 62d084883f part of check-in 4ad15db9ae
function A = damped_matrix (frequency,damping) ## usage: A = damped_matrix (frequency,damping) ## ## Gives an A matrix with eigenvalues with specified ## frequencies and damping ratio N = length(frequency); if nargin<2 damping = zeros(size(frequency)); endif if length(damping) != N error("Frequency and damping vectors have different lengths"); endif A = zeros(2*N,2*N); for i=1:N j = 2*(i-1)+1; A_i = [-2*damping(i)*frequency(i) -frequency(i)^2 1 0]; A(j:j+1,j:j+1) = A_i; endfor endfunction