Error calculation is not working

w1 = 0.4762;
w2 = -0.2152;
for k= 2: size(B)
B(k)= A(k)*w1+A(k-1)*w2;
end
disp(y);
for j= 2:size(B)
e(j)= B(j)-(A(j)*w1+A(j-1)*w2);
end
e(e==0)= [];
disp(e)
Ok this is the code, while k loop is running smoothly it doesn't seem so, to obtain any result at j loop for e that holds for error. A and B matrixes are perfectly loaded. What am I doing wrong??

2 commentaires

KSSV
KSSV le 5 Sep 2017
At the loop don't use size(B) ....either row or column dimensions which ever is required....YOu have not provided A and B....you didn't specify what is the error?
maybe you have to use 'length(B)' instead of 'size(B)' !

Réponses (0)

Cette question est clôturée.

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by