Dimensions of arrays being concatenated are not consistent.

1 view (last 30 days)
Hello there,
When I run my programm it says the error message written in the tittle. It says that for the 1st row of matrix A (line 79). Any suggestions?
Thanks.
P.S. I've uploaded the file in the message.

Accepted Answer

Stephan
Stephan on 5 Jul 2021
clc;
clear all;
close all;
%% Parametri
%% Inercija; {kg.m2}
Juc = 2.6e-2;
Jlc = 1e-3;
%% Krutost; {N.m/rad}
kuc = 114.59;
klc = 687.55;
kr = 400000;
%% Prigusenje; {N.m.s/rad}
duc = 6e-2;
dlc = 6;
dr = 12000;
%% Radijus; {m}
rpin = 7.78e-3;
%% Sila; {N}
Fr = 1;
Flim = 75;
Flim_column = 0.2;
Flim_torsion = 0.01;
%% Masa; {kg}
mr = 10;
%% Moment; {N.m}
MsAmp = 4.5;
%% Kutna brzina; {rad/s}
freq = 2;
%%
Kt = {0.3 , 'N.m/a'};
J = 0.01;
b = 0.1;
L = 0.5;
R = 1;
K = 0.01;
kESF = 8e6;
kESF_column = 7000;
kESF_torsion = 7000;
%% Ulazni podatci
time = 0.01: 0.01: 0.2;
Ms = MsAmp*sin(2*pi*freq*time);
dm = 0;
Jm = 0;
%% Algoritam prema kojem se racuna I iz Ms
if Ms >=3.5
I = 21.29*Ms-69.4;
elseif Ms < 3.5 & Ms >= 2
I = 2.73 * Ms - 4.47;
elseif Ms < 2 & Ms >= 0
I = 0.5 * Ms;
elseif Ms < 0 & Ms >= (-2)
I = 0.5 * Ms;
elseif Ms < (-2) & Ms >= (-3.5)
I = 2.73 * Ms + 4.47;
elseif Ms < (-3.5)
I = 21.29 * Ms + 69.4;
end
%% Matrice A, B, C i D
A = [0 1 0 0 0 0 0 0 0;
-kuc/Juc -duc/Juc kuc/Juc duc/Juc 0 0 0 0 0;
0 0 0 1 0 0 0 0 0;
kuc/Jlc duc/Jlc -kuc/Jlc -duc/Jlc -klc/Jlc -dlc/Jlc klc/Jlc*rpin dlc/Jlc*rpin 0;
0 0 0 0 0 1 0 0 0;
0 0 0 0 0 0 0 1 0;
0 0 0 0 -klc/mr*rpin -dlc/mr*rpin klc/mr*rpin dlc/mr*rpin 0;
0 0 0 0 0 0 0 0 1;
0 0 0 0 0 0 0 0 -dm/Jm];
B = [0 0 0;
1 -K 0;
0 0 0;
0 K/Jlc 0;
0 0 0;
0 0 0;
0 0 1;
0 0 0;
0 K/Jm 0];
C = B.';
D = 0;
  2 Comments
Stephan
Stephan on 6 Jul 2021
A = [0 1 0 0 0 0 0 0 0;
-kuc/Juc -duc/Juc kuc/Juc duc/Juc 0 0 0 0 0;
0 0 0 1 0 0 0 0 0;
kuc/Jlc duc/Jlc -kuc/Jlc -duc/Jlc -klc/Jlc - dlc/Jlc klc/Jlc*rpin dlc/Jlc*rpin 0;
% ^
% |
% ---- change this
A = [0 1 0 0 0 0 0 0 0;
-kuc/Juc -duc/Juc kuc/Juc duc/Juc 0 0 0 0 0;
0 0 0 1 0 0 0 0 0;
kuc/Jlc duc/Jlc -kuc/Jlc -duc/Jlc -klc/Jlc -dlc/Jlc klc/Jlc*rpin dlc/Jlc*rpin 0;
% ^
% |
% ---- to this. Otherwise MATLB
% interprets:
% -klc/Jlc - dlc/Jlc
% as one expression, which leads
% to having one column
% missing. Better: use
% comma to seperate
% entries in matrices
% and vectors

Sign in to comment.

More Answers (0)

Categories

Find more on Language Fundamentals in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by