comparison scripts/polynomial/spline.m @ 6014:437f9086b967

[project @ 2006-09-30 15:27:06 by jwe]
author jwe
date Sat, 30 Sep 2006 15:27:06 +0000
parents 376e02b2ce70
children 7fad1fad19e1
comparison
equal deleted inserted replaced
6013:13c4326d3501 6014:437f9086b967
92 ## Check the size and shape of y 92 ## Check the size and shape of y
93 ndy = ndims (y); 93 ndy = ndims (y);
94 szy = size (y); 94 szy = size (y);
95 if (ndy == 2 && (szy(1) == 1 || szy(2) == 1)) 95 if (ndy == 2 && (szy(1) == 1 || szy(2) == 1))
96 if (szy(1) == 1) 96 if (szy(1) == 1)
97 a = y'; 97 a = y.';
98 else 98 else
99 a = y; 99 a = y;
100 szy = fliplr (szy); 100 szy = fliplr (szy);
101 endif 101 endif
102 else 102 else
103 a = reshape (y, [prod(szy(1:end-1)), szy(end)])'; 103 a = reshape (y, [prod(szy(1:end-1)), szy(end)]).';
104 endif 104 endif
105 complete = false; 105 complete = false;
106 if (size (a, 1) == n + 2) 106 if (size (a, 1) == n + 2)
107 complete = true; 107 complete = true;
108 dfs = a(1,:); 108 dfs = a(1,:);
225 %!assert (spline(x',y',x'), y'); 225 %!assert (spline(x',y',x'), y');
226 %!assert (spline(x',y',x), y); 226 %!assert (spline(x',y',x), y);
227 %!assert (isempty(spline(x',y',[]))); 227 %!assert (isempty(spline(x',y',[])));
228 %!assert (isempty(spline(x,y,[]))); 228 %!assert (isempty(spline(x,y,[])));
229 %!assert (spline(x,[y;y],x), [spline(x,y,x);spline(x,y,x)]) 229 %!assert (spline(x,[y;y],x), [spline(x,y,x);spline(x,y,x)])
230 %! y = cos(x) + i*sin(x);
231 %!assert ( spline(x,y,x), y )
232 %!assert ( real(spline(x,y,x)), real(y) );
233 %!assert ( real(spline(x,y,x.')), real(y).' );
234 %!assert ( real(spline(x.',y.',x.')), real(y).' );
235 %!assert ( real(spline(x.',y,x)), real(y) );
236 %!assert ( imag(spline(x,y,x)), imag(y) );
237 %!assert ( imag(spline(x,y,x.')), imag(y).' );
238 %!assert ( imag(spline(x.',y.',x.')), imag(y).' );
239 %!assert ( imag(spline(x.',y,x)), imag(y) );