Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-11-26, 21:01   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
默认 Horner's algorithm using matrices

I am working o this question but I am having some difficulties as this is my first year of doing any type of programming



Write a non-recursive function HornerSimple which evaluates a polynomial p(x) using the Horner algorithm. The function should return the value of the polynomial for a given x and coefficient list a. It should be passed the following two arguments in exactly this order, i.e. it should be called as HornerSimple(a,x):
a : The list a = [a0, a1, . . . , an] of integer coefficients. Note that Matlab starts counting at 1, i.e. a(1) stores a0, a(2) stores a1 and so on; a contains n + 1 entries.
x : The integer number or a square matrix with integer entries at which the polynomial is evaluated.



The function HornerSimple should also work in the special case when the list a=[] is empty. In this case it
should return a zero matrix of the same size as x (and the 1 × 1 matrix [0] if x is a number).



[This is my code so far but I get error when I test it and I do not know how to change it to make it correct1





More answer...
poster 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 20:08


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.