NADCON5-ng
0.0.1
NADCON5 Next Generation
Home
Project Documentation
Code Documentation
Index
File List
File Members
qterp.f
Go to the documentation of this file.
1
c> \ingroup core
2
c> This function fits a quadratic function through 3 points
3
c>
4
c> This function fits a parabola (quadratic) function through
5
c> three *equally* spaced points along the x-axis
6
c> at indices 0, 1, and 2. The spacing along the
7
c> x-axis is "dx"
8
c>
9
c> Thus:
10
c>
11
c> \f{eqnarray*}{
12
c> f0 = f_0 &= y(x_0) \\
13
c> f1 = f_1 &= y(x_1) \\
14
c> f2 = f_2 &= y(x_2)
15
c> \f}
16
c>
17
c> Where:
18
c>
19
c> \f{eqnarray*}{
20
c> x_1 &= x_0 + dx \\
21
c> x_2 &= x_1 + dx \\
22
c> x_3 &= x_2 + dx
23
c> \f}
24
c>
25
c> The input value is some value of "x" that falls
26
c> between 0 and 2. The output value (qterp) is
27
c> the quadratic function at x.
28
c>
29
c>
30
c> \param[in] x Compute Interpolation at this positon, a value between 0 and 3
31
c> it is scaled relative to `x_0` `x_2` and `dx`. For example,
32
c> the value of 1.5 is `x_0 + 1.5*dx` which falls between `x1` and `x2`
33
c> \param[in] f0 `y` value at `x_0`
34
c> \param[in] f1 `y` value at `x_1 = x_0 + dx`
35
c> \param[in] f2 `y` value at `x_2 = x_0 + dx`
36
c> \return `real` quadratically interpolated value of `f(x*)` where `x* = x_0 + x*dxx`
37
c>
38
c> This function uses Newton-Gregory forward polynomial
39
c>
40
c> \f{eqnarray*}{
41
c> \nabla f_0 &=& f_1 -f_0 \\
42
c> \nabla f_1 &=& f_2 -f_1 \\
43
c> \nabla^2 f_0 &=& \nabla f_1 - \nabla f_0 \\
44
c> qterp(x, f_0, f_1, f_2) &=& f_0 + x \nabla f_0 + 0.5 x \left( x-1.0 \right) \nabla^2 f_0
45
c> \f}
46
real
function
qterp
(x,f0,f1,f2)
47
48
c - x = real*4
49
c - f0,f1,f2 = real*4
50
51
c - This function fits a parabola (quadratic) through
52
c - three points, *equally* spaced along the x-axis
53
c - at indices 0, 1 and 2. The spacing along the
54
c - x-axis is "dx"
55
c - Thus:
56
c -
57
c - f0 = y(x(0))
58
c - f1 = y(x(1))
59
c - f2 = y(x(2))
60
c - Where
61
c - x(1) = x(0) + dx
62
c - x(2) = x(1) + dx
63
64
c - The input value is some value of "x" that falls
65
c - between 0 and 2. The output value (qterp2) is
66
c - the parabolic function at x.
67
c -
68
c - This function uses Newton-Gregory forward polynomial
69
70
df0 =f1 -f0
71
df1 =f2 -f1
72
d2f0=df1-df0
73
74
qterp
=f0 + x*df0 + 0.5*x*(x-1.0)*d2f0
75
76
return
77
end
qterp
real function qterp(x, f0, f1, f2)
This function fits a quadratic function through 3 points.
Definition:
qterp.f:47
src
Subs
qterp.f
Generated on Mon Nov 20 2017 16:14:46 for NADCON5-ng by
1.8.11