Treść książki

Przejdź do opcji czytnikaPrzejdź do nawigacjiPrzejdź do informacjiPrzejdź do stopki
ItsnumericalapproximationhasbeencompletedbymeansofthefollowingMATLABscript:
%COEFFICIENTOFDATAERRORPROPAGATIONT(x),
%COMPUTEDFORTHEFORMULAy=sin(x)/x
%Symbolicapproach
symsf(x);f(x)=sin(x)/x;
T(x)=x*diff(f(x))/f(x);
fplot(T(x),[04*pi]);holdon;gridon
fprintf('T(x)=%s\n',simplify(T(x)))
%Numericalapproach
dx=1e-3;
f=@(x)sin(x)./x;
x=linspace(0.01,4*pi,50)';
y=f(x);
x_err=x*(1+dx);
y_err=f(x_err);
T=(y_err-y)./y/dx;%estimateofT(x)
plot(x,T,'or');holdon
axis([0,4*pi,-100,100]);gridon
xlabel('x');ylabel('T(x)');title('y=sin(x)/x')
legend('exactT(x)','estimateofT(x)')
%errorlevel('epsilon')
%analysedformula
%exactvaluesofy
%error-corruptedvaluesofx
%error-corruptedvaluesofy
T(x)=-(sin(x)-x*cos(x))/sin(x)
Solution(b):Inthiscase,asimplificationoftheoperatorispossibleandrecommendable:
y
±
1
1
++
+
xx
xx
2
2
+
x
x
3
3
±
(
(
1
1
+
x
x
)
)
(
(
1
1
+
+
x
x
2
2
)
)
±
1
1
+
x
x
Then:
Tx
()
±
yx
()
x
dyx
dx
()
±
x
1
1
+
x
x
(
1
2
x
)
2
±
1
2
x
x
2
ThisresulthasbeencheckedbymeansofthefollowingMATLABscript:
%COEFFICIENTOFDATAERRORPROPAGATIONT(x),
%COMPUTEDFORy=(1+x+x^2+x^3)/(1-x+x^2-x^3)
%Symbolicapproach
symsf(x);
f(x)=(1+x+x^2+x^3)/(1-x+x^2-x^3);%analysedformula
T(x)=x*(diff(f(x))/f(x));
fplot(T(x),[03]);holdon;gridon
fprintf('T(x)=%s\n',simplify(T(x)))
%Numericalapproach
dx=1e-3;
%errorlevel('epsilon')
f=@(x)(1+x)./(1-x);%analysedformula
x=linspace(0,3,50)';
y=f(x);
%exactvaluesofy
x_err=x*(1+dx);
%error-corruptedvaluesofx
y_err=f(x_err);
%error-corruptedvaluesofy
T=(y_err-y)./y/dx;
%estimateofT(x)
plot(x,T,'or');holdon
axis([0,3,-100,100]);gridon
xlabel('x');ylabel('T(x)');
Nu='(1+x+x^2+x^3)';De='(1-x+x^2-x^3)';
title(['y=',Nu,'/',De]);
legend('exactT(x)','estimateofT(x)')
T(x)=-(2*x)/(x^2-1)
Problem1.4:DeterminethefunctionT(x),characterisingthepropagationoftherelativeerrorinthevariable
xduringcomputingthevaluesofthefunction
yx
±
1
x
.
Solution#1:ThedirectdifferentiationoftheRHSshouldfollowthefollowingrule:
dx
d
Ffxfx
(
1
()
,
2
()
)
±
B
Fyy
(
B
y
1
1
2
)
y
1
±
fx
1
()
dfx
1
dx
()
+
B
Fyy
(
B
y
1
2
,
2
)
y
1
±
fx
1
()
dfx
2
dx
()
,
y
2
±
fx
2
()
y
2
±
fx
2
()
Intheconsideredcase:
fx
1
()
=
x
,
fx
2
()
=
x
1
and
Fyy
(
1
,
2
)
=
y
1
y
2
15