Concatenation error during frequency response analysis

3 ビュー (過去 30 日間)
Michael Gibson
Michael Gibson 2019 年 11 月 25 日
コメント済み: Michael Gibson 2019 年 11 月 25 日
So I have a system that I'm trying to run frequency response analysis on manually through Matlab, but part way through my code I get a concatenation error and I'm not sure why Matlab is even concatenating in the first place. Can anyone help? Thanks!
I6 = 3;
L = 0.5;
I3 = 1.2 * I6;
f_n = 1;
k = I3*(2*pi()*f_n)^2;
C2 = 1/k;
C8 = -9.81;
I9 = (I6*L^2)/12;
H = L^2*I3*I9+L^2*I6*I9-4*I3*I6;
omega = [0:0.001:2*pi()];
S = i*omega;
X = det([0 -1/I3 0 0; (H-L^2*I9)/(H) S (2*L^2*I3*I6)/(H*C8) 0; 0 0 S -1/I9; -(2*L*I9)/H 0 -(2*L*I3*I6+H)/(H*C8) S]);
Theta = det([S -1/I3 0 0; (L^2*I6*I9)/(H*C2) S (H-L^2*I9)/H 0; 0 0 0 -1/I9; -(2*L*I6*I9)/(H*C2) 0 -(2*L*I9)/H S]);
F_in = det([0 -1/I3 0 0; (L^2*I6*I9)/(H*C2) S (2*L^2*I3*I6)/(H*C8) 0; 0 0 S -1/I9; -(2*L*I6*I9)/(H*C2) 0 -(2*L*I3*I6+H)/(H*C8) S]);
ANS1 = abs(X/F_in)
ANS2 = abs(Theta/F_in)

採用された回答

Turlough Hughes
Turlough Hughes 2019 年 11 月 25 日
編集済み: Turlough Hughes 2019 年 11 月 25 日
Your problem is in these lines because S has 6284 elements:
X = det([0 -1/I3 0 0; (H-L^2*I9)/(H) S (2*L^2*I3*I6)/(H*C8) 0; 0 0 S -1/I9; -(2*L*I9)/H 0 -(2*L*I3*I6+H)/(H*C8) S]);
Theta = det([S -1/I3 0 0; (L^2*I6*I9)/(H*C2) S (H-L^2*I9)/H 0; 0 0 0 -1/I9; -(2*L*I6*I9)/(H*C2) 0 -(2*L*I9)/H S]);
F_in = det([0 -1/I3 0 0; (L^2*I6*I9)/(H*C2) S (2*L^2*I3*I6)/(H*C8) 0; 0 0 S -1/I9; -(2*L*I6*I9)/(H*C2) 0 -(2*L*I3*I6+H)/(H*C8) S]);
I suspect the following is what you need:
I6 = 3;
L = 0.5;
I3 = 1.2 * I6;
f_n = 1;
k = I3*(2*pi()*f_n)^2;
C2 = 1/k;
C8 = -9.81;
I9 = (I6*L^2)/12;
H = L^2*I3*I9+L^2*I6*I9-4*I3*I6;
omega = [0:0.001:2*pi()];
S = i*omega;
X=nan(size(S));Theta=nan(size(S)); F_in=nan(size(S));
for c=1:length(S)
X(c) = det([0 -1/I3 0 0; (H-L^2*I9)/(H) S(c) (2*L^2*I3*I6)/(H*C8) 0; 0 0 S(c) -1/I9; -(2*L*I9)/H 0 -(2*L*I3*I6+H)/(H*C8) S(c)]);
Theta(c) = det([S(c) -1/I3 0 0; (L^2*I6*I9)/(H*C2) S(c) (H-L^2*I9)/H 0; 0 0 0 -1/I9; -(2*L*I6*I9)/(H*C2) 0 -(2*L*I9)/H S(c)]);
F_in(c) = det([0 -1/I3 0 0; (L^2*I6*I9)/(H*C2) S(c) (2*L^2*I3*I6)/(H*C8) 0; 0 0 S(c) -1/I9; -(2*L*I6*I9)/(H*C2) 0 -(2*L*I3*I6+H)/(H*C8) S(c)]);
end
ANS1 = abs(X./F_in)
ANS2 = abs(Theta./F_in)
  1 件のコメント
Michael Gibson
Michael Gibson 2019 年 11 月 25 日
Oh. I feel stupid now. I've used for loops in that fashion multiple times in the past month. Why didn't that occur to me?
Thanks for the help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by