Asking about an output
古いコメントを表示
%% Differentiation of tan^{-1}x at 1
clear all;
clc;
f=@(x) atan(x);
a=1;
h=10.^[-2:-1:-4];
eVal=1/(1+a^2);
%% Forward difference formula
errf=zeros(length(h),1);
for i=1:length(h)
fDiff(i)=(f(a+h(i))-f(a))/h(i);
errf(i)=abs(eVal-fDiff(i));
end
disp(errf);
%% Central difference formula
errc=zeros(length(h),1);
for i=1:length(h)
fCen(i)=(f(a+h(i))-f(a-h(i)))/(2*h(i));
errc(i)=abs(eVal-fCen(i));
end
disp(errc);
%% Backward Difference formula
errb=zeros(length(h),1);
for i=1:length(h)
fBack(i)=(f(a)-f(a-h(i)))/h(i);
errb(i)=abs(eVal-fBack(i));
end
disp(errb);
The output is:
0.002491666914583
0.000249916666750
0.000024999166126
1.0e-05 *
0.833308332937044
0.008333328516130
0.000083316731292
0.002508333081242
0.000250083333320
0.000025000832460
My question is why the term 1.0e-05 * appearing?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!