Y= 題目内容: 编写程序,根据x求y的值. 7x-20 3x244x-6 2x3-28 10x-2 输入输出说明: Input x:-20 y=-160.00代码编辑: X<-10 -10<=x<5 5<=x<200 x>=20e -Font size--
时间: 2024-06-06 22:08:06 浏览: 19
由于题目中提供了多个表达式,需要分别计算每个表达式的结果。
当输入的x为-20时,计算得出:
y1 = 7x - 20 = 7*(-20) - 20 = -160
y2 = 3x^2 + 44x - 6 = 3*(-20)^2 + 44*(-20) - 6 = -1466
y3 = 2x^3 - 28 = 2*(-20)^3 - 28 = -16028
y4 = 10x - 2 = 10*(-20) - 2 = -202
因此,输出的y为-160.00。
对于其他情况,按照上述方法分别计算每个表达式的结果即可。
相关问题
用MATLAB编写脚本文件求多项式 y =x4-3x3+2x+5的导数
可以使用MATLAB中的diff函数来求解多项式的导数,具体代码如下:
syms x;
y = x^4 - 3*x^3 + 2*x + 5;
dy = diff(y, x);
disp(dy);
输出结果为:4*x^3 - 9*x^2 + 2
因此,多项式 y =x4-3x3+2x+5 的导数为 4x^3 - 9x^2 + 2。
用MATLAB编写脚本文件求多项式函数 y =x4-3x3+2x+5的根
您好,我可以回答这个问题。可以使用MATLAB中的roots函数来求解多项式函数的根。具体的脚本代码如下:
syms x
y = x^4 - 3*x^3 + 2*x + 5;
r = roots(sym2poly(y))
其中,sym2poly函数可以将符号表达式转换为多项式系数向量,roots函数可以求解多项式函数的根。执行以上代码后,可以得到多项式函数的四个根。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)