- 阅读权限
- 255
- 威望
- 1 级
- 论坛币
- 49392 个
- 通用积分
- 51.6904
- 学术水平
- 370 点
- 热心指数
- 273 点
- 信用等级
- 335 点
- 经验
- 57815 点
- 帖子
- 4006
- 精华
- 21
- 在线时间
- 582 小时
- 注册时间
- 2005-5-8
- 最后登录
- 2023-11-26
|
- Sample Problem 8-1: Calculating polynomials with MATLAB
- For the polynomial f(x) = x5 − 12.1x4 + 40.59x3 − 17.015x2 − 71.95x + 35.88 :
- (a) Calculate f(9).
- (b) Plot the polynomial for −1.5 ≤ x ≤ 6.7.
- Solution
- The problem is solved in the Command Window.
- (a) The coefficients of the polynomials are assigned to vector p. The function polyval is then used to calculate the value at x = 9.
- >> p = [1 -12.1 40.59 -17.015 -71.95 35.88];
- >> polyval(p,9)
- ans =
- 7.2611e+00
复制代码
|
|