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
 
>> 

 

posted @ 2020-09-22 08:37  西北逍遥  阅读(1762)  评论(0编辑  收藏  举报