我在SO的帮助下编写了代码,将k_12的值绘制成了频率 . 但是,现在我需要绘制3个图形,每个频率一个,x轴上的k_12值和y轴上相应的3个模式形状 . 对于每个频率,模式形状以矩阵V的列排列 . 这是一段代码:
M = [3 0 0; 0 2 0; 0 0 0.5] % mass matrix
i_vals = 1:1000:60e07; % values of k_12 from 1 to 60 million in steps of 1000
freq = 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);
values=diag(L);
[values,I]=sort(values);
V(:,I)=V; % V is the mode shapes matrix (3x3)
freq(:, n)=sqrt(values)/(2*pi);
end
h = loglog(i_vals, freq');
title('Effect of change of value of k_1_2 on the value of natural frequency');
xlabel('Value of k_1_2 [N/m]');
ylabel('Value of natura