relError.m

版本 1.1.0.0 (3.9 KB) 作者: Daniel Simmons
Compute relative error between n-dimensional arrays.
508.0 次下载
更新时间 2014/9/15

查看许可证

Finding the relative error between arrays can be useful, for instance, in determining whether an iterative function is converging to the correct solution.
I use this function to test whether adjustments to my numerical solver is approaching the analytical solutions, but of course there are many applications where an indicative error would be useful.

To use the function is simple. With the arrays/matrices you want to compare at hand:

relError( A,B,C,... )

where size(A)=size(B)=size(C).

The function outputs a 2D array of size nArgs x nArgs comparing each input to each input. Use 'display' parameter to suppress the output text.

Example:

A=[1 2];
B=[1 2];
C=[2 4];
err = relError(A,B,C,'display',false)

err =
A B C
A --> 0 0 100
B --> 0 0 100
C --> 50 50 0

So for the error between the first argument and the third argument, use err(1,3).

引用格式

Daniel Simmons (2024). relError.m (https://www.mathworks.com/matlabcentral/fileexchange/47834-relerror-m), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2013a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.1.0.0

Update decription

1.0.0.0