matlab一元二次方程求根

绘制函数图像

>> x1=-10:0.5:15; 
>> y1=x1.^2-5*x1+6; 
>> plot(x1,y1) 

求方程的根

syms x
f=x^2-5*x+6
result=solve(f==0,x)

输出结果为:

result =
 
 2
 3
 
>> 
QQ 3087438119
原文地址:https://www.cnblogs.com/herd/p/13710056.html