📄 testnder.m
字号:
function [] = testnder(h, n)
% Test file for the function numder. The initial step size is h and
% the number of iterations is n. Function to be tested is
% f(x) = exp(-x^2).
format long
disp(' x numder exact')
disp(sprintf('\n _____________________________________________________'))
s = [];
for x=.1:.1:1
s1 = numder('exp2', x, h, n);
s2 = derexp2(x);
disp(sprintf('%1.14f %1.14f %1.14f',x,s1,s2))
end
function y = derexp2(x)
% First order derivative of f(x) = exp(-x^2).
y = -2*x.*exp(-x.^2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -