comparison scripts/general/trapz.m @ 7992:80e3fe8938f2

Trivial doc fix
author David Bateman <dbateman@free.fr>
date Tue, 29 Jul 2008 18:21:47 +0200
parents a1dbe9d80eee
children b88596e8f341
comparison
equal deleted inserted replaced
7991:139f47cf17ab 7992:80e3fe8938f2
71 dim = 1; 71 dim = 1;
72 endif 72 endif
73 else 73 else
74 dim = floor (dim); 74 dim = floor (dim);
75 if (dim < 1 || dim > nd) 75 if (dim < 1 || dim > nd)
76 error ("cumtrapz: invalid dimension along which to sort"); 76 error ("trapz: invalid dimension along which to sort");
77 endif 77 endif
78 endif 78 endif
79 79
80 n = sz(dim); 80 n = sz(dim);
81 idx1 = cell (); 81 idx1 = cell ();
88 88
89 if (! have_x) 89 if (! have_x)
90 z = 0.5 * sum (x(idx1{:}) + x(idx2{:}), dim); 90 z = 0.5 * sum (x(idx1{:}) + x(idx2{:}), dim);
91 else 91 else
92 if (! size_equal (x, y)) 92 if (! size_equal (x, y))
93 error ("cumtrapz: x and y must have same shape"); 93 error ("trapz: x and y must have same shape");
94 endif 94 endif
95 z = 0.5 * sum ((x(idx1{:}) - x(idx2{:})) .* 95 z = 0.5 * sum ((x(idx1{:}) - x(idx2{:})) .*
96 (y(idx1{:}) + y(idx2{:})), dim); 96 (y(idx1{:}) + y(idx2{:})), dim);
97 endif 97 endif
98 endfunction 98 endfunction