Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
.
0 Commenti
Risposte (1)
Torsten
il 7 Dic 2022
Modificato: Torsten
il 7 Dic 2022
k1=180; k2=50; k3=220;
knew=linspace(k1*0.4,k1*1.6,20);
m1=1.1; m2=3.4;
for i=1:length(knew)
K{i}=[knew(i)+k2,-k2;-k2,k2+k3];
M{i}=[m1,0;0,m2];
lambda{i}=eig(double(K{i}),double(M{i}));
omega_nf{i}=sqrt(lambda{i});
end
omega_nf{1:end}
2 Commenti
Torsten
il 7 Dic 2022
Modificato: Torsten
il 8 Dic 2022
k1=180; k2=50; k3=220;
knew=linspace(k1*0.4,k1*1.6,20);
m1=1.1; m2=3.4;
for i=1:length(knew)
K{i}=[knew(i)+k2,-k2;-k2,k2+k3];
M{i}=[m1,0;0,m2];
lambda{i}=eig(double(K{i}),double(M{i}));
omega_nf{i}=sqrt(lambda{i});
end
plot(cell2mat(omega_nf),knew)
grid on
If you don't need K, M and lambda in further calculations, you can also do
k1=180; k2=50; k3=220; n = 20;
knew=linspace(k1*0.4,k1*1.6,n);
m1=1.1; m2=3.4;
omega_nf = zeros(2,n);
for i=1:n
K=[knew(i)+k2,-k2;-k2,k2+k3];
M=[m1,0;0,m2];
lambda=eig(K,M);
omega_nf(:,i)=sqrt(lambda);
end
plot(omega_nf,knew)
grid on
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!