comparison scripts/polynomial/poly.m @ 1336:33d5c2471c09

[project @ 1995-08-25 01:53:42 by jwe]
author jwe
date Fri, 25 Aug 1995 01:53:42 +0000
parents 611d403c7f3d
children 5d29638dd524
comparison
equal deleted inserted replaced
1335:955705f55fef 1336:33d5c2471c09
43 v = eig (x); 43 v = eig (x);
44 else 44 else
45 usage ("poly (x), where x is a vector or a square matrix"); 45 usage ("poly (x), where x is a vector or a square matrix");
46 endif 46 endif
47 47
48 y = [1, zeros (1, n)]; 48 y = zeros (1, n+1);
49 y(1) = 1;
49 for j = 1:n; 50 for j = 1:n;
50 y(2:(j+1)) = y(2:(j+1)) - v(j) .* y(1:j); 51 y(2:(j+1)) = y(2:(j+1)) - v(j) .* y(1:j);
51 endfor 52 endfor
52 53
53 if (all (all (imag (x) == 0))) 54 if (all (all (imag (x) == 0)))