<< CL_addm Math CL_chebyshevEval >>

celestlab >> Math > CL_adjustState

CL_adjustState

Adjustment of initial state vector (least squares)

Calling Sequence

[X0, info] = CL_adjustState(t0, X0, t, Zref, fun [[, opts]])
[X0, info] = CL_adjustState(t0, X0, t, Zref, list(fun, p1, p2 ... pn) [[, opts]])

Description

Parameters

t0:

Initial time (1x1)

X0:

Initial/adjusted state vector (Px1)

t:

Times at which measurements are given (1xN)

Zref:

Reference measurements at times t (KxN)

fun:

Function that computes the measurements: function or list(function [, p1, ...]). See above for details.

opts:

(structure, optional) Computation options. See above for details.

info:

(structure) Additional information on the results. See above for details.

Authors

Examples

// ------------------------------
// Case 1: Jacobian is not computed
// ------------------------------

// Model
function [z]=F1(t0, x0, t, p)
z = x0(1) + x0(2)^2 * (t - t0) + p;
endfunction

// Initial and measurements times
t0 = 0;
t = t0 + linspace(0, 2, 100);
p1 = 0;

// Exact solution
x0_ref = [1; 2];
z_ref = F1(t0, x0_ref, t, p1);

// Initial state vector estimate
x0_est = x0_ref + [-0.2; 0.1];

// Options: default values
// "useJac" explicitly set although %f is the default
opts = struct();
opts.useJac = %f;

x0 = CL_adjustState(t0, x0_est, t, z_ref, list(F1, p1), opts);
x0 - x0_ref

// ------------------------------
// Case 2: Jacobian is computed
// and used
// ------------------------------

function [z, jac]=F2(t0, x0, t, p)
z = F1(t0, x0, t, p);
jac = zeros(1, 2, length(t));
jac(1, 1, :) = 1;
jac(1, 2, :) = 2 * x0(2) * (t - t0);
endfunction

// Options: change value of "useJac"
opts.useJac = %t;

x0 = CL_adjustState(t0, x0_est, t, z_ref, list(F2, p1), opts);
x0 - x0_ref

Report an issue
<< CL_addm Math CL_chebyshevEval >>