编写代码:求关于x,y代数方程组
的解,并写出结果。[文件题]
参考答案
程序:
clear all;
syms a b c x y;
fun=[a*x^2+b*y+c,x+y];
t1=solve(fun,x,y)
t1.x
t1.y
结果:
ans =
(b - (b^2 - 4*a*c)^(1/2))/(2*a)
(b + (b^2 - 4*a*c)^(1/2))/(2*a)
ans =
-(b - (b^2 - 4*a*c)^(1/2))/(2*a)
-(b + (b^2 - 4*a*c)^(1/2))/(2*a)