Last change
on this file since 171 was 2, checked in by Rick van der Zwet, 15 years ago |
Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)
|
File size:
559 bytes
|
Rev | Line | |
---|
[2] | 1 | function fout = foutperc(A, Ak)
|
---|
| 2 | % given matrix A and its approximation Ak
|
---|
| 3 | % determine percentage error in function values
|
---|
| 4 | % difference in A - Ak in percentage is given
|
---|
| 5 | [m, n] = size(A);
|
---|
| 6 | B = A - Ak;
|
---|
| 7 |
|
---|
| 8 | % ik heb de loops in elkaar geschoven, vanwege leesbaarheid en
|
---|
| 9 | % snelheid
|
---|
| 10 | magA = 0.0;
|
---|
| 11 | magB = 0.0;
|
---|
| 12 | for i=1:m
|
---|
| 13 | for j=1:n
|
---|
| 14 | magA = magA + abs(A(i,j));
|
---|
| 15 | magB = magB + abs(B(i,j));
|
---|
| 16 | end
|
---|
| 17 | end
|
---|
| 18 | magA = magA / (m * n);
|
---|
| 19 | magB = magB / (m * n);
|
---|
| 20 | fout = magB * 100 / magA;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.