Concatenation error during frequency response analysis

3 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by