MATLAB Answers


Piecewise evaluation of mean absolute error an plotting

Asked by Joaquim on 4 Aug 2017
Latest activity Commented on by Matt J
on 4 Aug 2017
Hello everybody,
I have two vectors, A and B. A represents the reference and B a noisy reconstruction.
I want to calculate the mean absolute error, MAE, in groups in a range of 20 units.
Then, I want to plot(A, MAE) using this piecewise evaluation.
How can I do this?


Sign in to comment.

1 Answer

Answer by Matt J
on 4 Aug 2017
Edited by Matt J
on 4 Aug 2017

Something like the following, I suppose,
MAE = conv(abs(A(:)-B(:)), ones(20,1)/20 ,'valid');


I want to do plot(A,MAE) but MAE and A seem to have different lenghts
They should have different lengths. The number of length=20 sections of A and B is shorter than A and B.
You could try doing conv(...,'same') instead of 'valid'.

Sign in to comment.