Concatenation error during frequency response analysis

조회 수: 10 (최근 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 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