31 lines
537 B
Matlab
31 lines
537 B
Matlab
clc
|
|
|
|
X = [1/(3+l); (-1)/(1-l); (-1)/(2-l)]
|
|
|
|
syms l
|
|
a1 = (3+l)^2;
|
|
a2 = (1-l)^2;
|
|
a3 = (2-l)^2;
|
|
|
|
t1 = a2*a3
|
|
t2 = a1*a3
|
|
t3 = a1*a2
|
|
t4 = a1*a2*a3
|
|
|
|
c1 = fliplr(coeffs(t1))
|
|
c2 = fliplr(coeffs(t2))
|
|
c3 = fliplr(coeffs(t3))
|
|
c4 = fliplr(coeffs(t4))
|
|
|
|
ctot = fliplr(coeffs(t1+t2+t3-t4))
|
|
|
|
sol = double(solve(t1+t2+t3-t4==0, l, 'Real', true))
|
|
|
|
for i=1:size(sol, 1)
|
|
Xi = double(subs(X,l,sol(i)))
|
|
Li = sol(i);
|
|
Ci = norm(Xi, 2)^2 - 1;
|
|
Yi = sum(Xi .* Xi .* [-3;1;2]) + sum(2 * Xi);
|
|
fprintf("lambda=%.03f ci=%g y=%g", Li, Ci, Yi);
|
|
end
|
|
|