资 源 简 介
录入程序代码,并对该实验代码进行调试,检查程序代码中的语法和语义错误。
编写函数f(x)的代码如下:
Romberg算法¨
function z=f(x)
if (x~=0)
z=sin(x)/x
else
z=1
end
备注:在实验代码中,首先输入必要的变量的值如下:
a=0
b=1
tol=1e-8
待查询检查通过,开始输入执行代码
设置格式format short g查看u的值和sin(u)的值:
-Input program code, and debugging code for the experiment to check the program code in the syntax and semantic errors. The preparation of a function f (x) of the code is as follows: Romberg algorithm ¨ function z = f (x) if (x ~ = 0) z = sin (x)/x else z = 1 end Note: In the experimental code, First, enter the necessary value of the variable is as follows: a = 0 b = 1 tol = 1e-8 pending inquiries, checking through, began to enter the implementation of the code format format short g see u, values and sin (u) values: