我在你的帮助下写了以下代码:
M = [3 0 0.0;
0 2 0.0;
0 0 0.5]; % mass matrix
i_vals = 0:1000:60e06; % values of k_12 from 1 to 600 million in steps of 1000
modes = zeros(3, length(i_vals));
for n=1:length(i_vals)
i = i_vals(n); % i is the value of k_12
K = [i+8e06 -i -2e06; -i i+2e06 -1e06; -2e06 -1e06 5e06]; % stiffness matrix
[V,L]=eig(K,M);
modes(:, n) = V(:,1); % natural frequency can be either 1, 2 or 3
end
semilogx(i_vals, modes')
title('Effect of change of value of k_1_2 on the value of mode shapes for the first natural frequency');
xlabel('Value of k_1_2 [N/m]');
ylabel('Value of mode shapes]');
hleg1 = legend('mode shape 1','mode shape 2', 'mode shape 3');
grid on;
grid minor;
问题在于某些值Matlab突然从正值切换到负值:
这是否归因于eig()
功能?怎么可能解决它?