[go: up one dir, main page]

Menu

[r370]: / coco / tests / sfh3coeff.m  Maximize  Restore  History

Download this file

30 lines (25 with data), 492 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function [ A B C D ] = sfh3coeff( x0, t0, x1, t1 )
%SFH3COEFF Scale free Hermite polynomial coefficients.
dx = x1-x0;
t00 = t0'*t0;
t01 = t0'*t1;
t11 = t1'*t1;
dx0 = dx'*t0;
dx1 = dx'*t1;
if 1-t01 > 1.0e-12
% qubic spline with
% [C'*C' + 9*D'*D](al) = Min!
AA = [ 13*t00 11*t01 ; 11*t01 10*t11 ];
bb = [ 24*dx0 ; 21*dx1 ];
al = AA\bb;
A = x0;
B = al(1)*t0;
D = al(2)*t1 + B - 2*dx;
C = dx - B - D;
else
% linear interpolation
A = x0;
B = dx;
C = zeros(size(x0));
D = C;
end