Wha calculations are behind these statements?
Mostra commenti meno recenti
As a beginner with Matlab, I'm trying to understand the numerical calculations behind three statements in the following code extract, and I'm hoping someone could explain them for me: - -
% Based on "adaptlob" by Walter Gautschi.
% Ref: W. Gander and W. Gautschi, "Adaptive Quadrature Revisited", 1998.
% http://www.inf.ethz.ch/personal/gander
% Copyright 1984-2004 The MathWorks, Inc.
% $Revision: 1.8.4.7 $ $Date: 2004/12/06 16:35:09 $
f = fcnchk(funfcn);
% Initialize with 13 function evaluations.
c = (a + b)/2;
h = (b - a)/2;
s = [.942882415695480 sqrt(2/3) .641853342345781 1/sqrt(5) .236383199662150];
x = [a c-h*s c c+h*fliplr(s) b];
y = feval(f,x,varargin{:}); y = y(:).';
fcnt = 13;
% Increase tolerance if refinement appears to be effective.
Q1 = (h/6)*[1 5 5 1]*y(1:4:13).';
Q2 = (h/1470)*[77 432 625 672 625 432 77]*y(1:2:13).';
s = [.0158271919734802 .094273840218850 .155071987336585 ...
.188821573960182 .199773405226859 .224926465333340];
w = [s .242611071901408 fliplr(s)];
Q0 = h*w*y.';
r = abs(Q2-Q0)/abs(Q1-Q0+realmin(class(Q0)));
-
-
In a mathematical calculation sense, what are the numbers being used to calculate these terms:
1. the expression for w?
2. the expression for Q0?
3. the term realmin(class(Q0))?
I understand the remaining code. Any assistance appreciated. Thanks
Risposta accettata
Più risposte (1)
kubota555
il 12 Mag 2015
0 voti
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!