A= [5 6 7 8]
B= [4 5 6 7]
for i=1:4,
C(i) = A(i+1) - A(i)
D(i) = C(i)*B(i)
E(i) = D(i+1) + D(i)
end
can anybody help me with this code
every time i get a value for D i want to add them to the previous value of D but i am getting an error
Attempted to access D(2); index out of bounds because numel(D)=1.
B= [4 5 6 7]
for i=1:4,
C(i) = A(i+1) - A(i)
D(i) = C(i)*B(i)
E(i) = D(i+1) + D(i)
end
can anybody help me with this code
every time i get a value for D i want to add them to the previous value of D but i am getting an error
Attempted to access D(2); index out of bounds because numel(D)=1.