comparison scripts/polynomial/polyval.m @ 7411:83a8781b529d

[project @ 2008-01-22 21:52:25 by jwe]
author jwe
date Tue, 22 Jan 2008 21:52:26 +0000
parents a1dbe9d80eee
children 2df882e69f13
comparison
equal deleted inserted replaced
7410:8a3b2ccc4e11 7411:83a8781b529d
59 for index = 2:n 59 for index = 2:n
60 y = c (index) + x .* y; 60 y = c (index) + x .* y;
61 endfor 61 endfor
62 62
63 endfunction 63 endfunction
64
65 %!assert(polyval ([1, 1, 1], 2) == 7);
66
67 %!assert(all (all (polyval ([1, 1, 1], [0; 1; 2]) == [1; 3; 7])));
68
69 %!assert(isempty (polyval ([1, 1, 1], [])));
70
71 %!assert(all (all (polyval ([1, 1, 1], [-1, 0; 1, 2]) == [1, 1; 3, 7])));
72
73 %!error polyval ([1, 2; 3, 4], [-1, 0; 1, 2]);
74
75 %!assert(isempty (polyval ([], [-1, 0; 1, 2])));
76