Untitled
unknown
matlab
3 years ago
424 B
4
Indexable
function error = calculateMaxError(dValues,aValues)
% since diff loses 1 element for each derivate, we only compare
% the first length(dValues) elements of aproximateValue
splitAValues = aValues(1:length(dValues));
relativeErrorFunc = @(x)(abs((splitAValues(x) - dValues(x)) / dValues(x)) * 100)
relativeErrors = arrayfun(relativeErrorFunc,1:length(dValues));
error = max(relativeErrors)
end
Editor is loading...