- #1
gsb
- 2
- 0
Homework Statement
hi, i am having some problem with a code in matlab. my code is:
t = 30;
H= 30;
h= 3;
n = H/h;
qqq= 10;
a= 3;
b = .2;
k= 0.04;
Lo= 100;
g= 9.81;
for i = 1:t
q(i) = 0;
for j = 1:n
nl = qqq + (j*h)/(a + b*(j*h));
nlt = nl*(0.0172*log(i) + 1);
q(i) = q(i) + 2*k*(Lo/100)*(nlt/3)*g*exp(-k*(i));
end
plot((1:t), q);
end
Homework Equations
this is the code and i keep getting this error- "Attempted to access q(2); index out of bounds because numel(q)=1."
help would be greatly appreciated.
thanks