Unable to perform assignment because the left and right sides have a different number of elements error

1 vue (au cours des 30 derniers jours)
when running this algorithm i get the following error "
Error in Grammel (line 36)
t1(i) = ot(i) + b*(w^2)*(r(i).^2);
>> Grammel
Unable to perform assignment because the left and right sides have a
different number of elements."
it seems to me as if t1(i) is the i-th element of a 1*6 integer matrix, which is defined as ot(i) (the ith element of another integer 1*6 matrix)+ (someconstant)*r(i) (yet another ith elementof an 1*6 integer matrix).
i dont see what the issue is here or why the integer value of t1(i) shouldn´t have the same dimensions as the two other integer values added together.
p = 1;
u = 0.31;
a = ((3+u)/8)*p;
b = ((1+3*u)/8)*p;
f = 14897/60;
w =2*pi*f;
%TEILSCHEIBE 1
or = [15.8e+7,0,0,0,0,0];
ot= [2.3778e+11,0,0,0,0,0];
%orinnen = [1,0,0,0,0,0];
%otinnen= [1,0,0,0,0,0];
r = [56,112,168,224,280,325];
%rinnen = [1,2,3,4,5,6];
b = [45,30,40,50,60,70]; %breite der iten Teilscheibe
db =[15,10,10,10,10,10]; %aenderung Teilscheibentiefe von i zu i+1
A = [0,0,0,0,0,0]; %Flächeninhalt ringscheibe
s1 = [0,0,0,0,0,0];
t1 = [0,0,0,0,0,0];
ss = [0,0,0,0,0,0];
ts = [0,0,0,0,0,0];
do = [0,0,0,0,0,0];
dt =[0,0,0,0,0,0];%delta t
for i = 1:6
s1(i) = or(i) + a*(w^2)*(r(i).^2);
t1(i) = ot(i) + b*(w^2)*(r(i).^2);
K1i = (si1+ti1)/2;
K2i = (si1-ti1)/(2/(r(i)^2));
si2 = K1i + K2i/(r(i+1)^2);
ti2 = K1i - K2i/(r(i+1)^2);
or(i+1) = si2 -a*(w^2)*(r(i+1)^2)
ot(i+1) = ti2 -a*(w^2)*(r(i+1)^2)
dsi = (-db(i)/(b(i)+db(i)))*or(i+1);
dti = u *dsi;
ss(i) = si2 + dsi;
ts(i) = ti2 + dti;
s1(i+1) = ss(i);
t1(i+1) = ts(i);
do(i) = ot(i)+ot(i+1);
A(i) = pi* ((r(i)^2)-(r(i+1)^2));
doA(i) = do(i).*A(i);
end
otm = sum(doA)/(2*sum(A))
bm = (otm*1.5)/1400

Réponses (1)

Matt J
Matt J le 10 Déc 2019
Modifié(e) : Matt J le 10 Déc 2019
It's because in that line, b is not a scalar, even though everything else is:
  1 commentaire
Matt J
Matt J le 10 Déc 2019
Modifié(e) : Matt J le 10 Déc 2019
Incidentally, this is a kind of routine error that you will want to learn to detect for yourself using Error Breakpoints:

Connectez-vous pour commenter.

Catégories

En savoir plus sur Chemistry dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by