Untitled

Anonymous
matlab
10/21/2022 5:15 PM
568 B
13
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...