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 comentarios

KSSV
KSSV el 5 de Sept. de 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?
Floriane Madeleine Schreiber
Floriane Madeleine Schreiber el 5 de Sept. de 2017
maybe you have to use 'length(B)' instead of 'size(B)' !

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Preguntada:

el 5 de Sept. de 2017

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by