Untitled

 avatar
unknown
matlab
2 years ago
424 B
0
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...