?? 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 + -