03.12.2012 Views

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

284 CHAPTER 14. NUMERICAL EXERCISES<br />

void step( T const& t, Base& base, F const& f ) {<br />

...<br />

}<br />

public:<br />

// Return the solution<br />

typedef ... x type ;<br />

x type const& x() const { ... }<br />

private:<br />

...<br />

14.7.5 Test problems<br />

We now solve the following test problems. First, consider the following expansion:<br />

f(t) = ξ1 + ξ2 cos t + ξ3 sin t + ξ4cos2t + ξ5 sin 2t<br />

We compute the coefficients following the least squares criterion <strong>for</strong> the function<br />

f = (2 − 5 cos t)<br />

Print the solution x <strong>for</strong> each step of the Kalman filter and see how it changes. It should be very<br />

close to the function.<br />

Then apply random noise with relative size 0.0001:<br />

f = (2 − 5 cos t)(1 + 0.0001ɛ)<br />

where ɛ is a random number in [−1, 1]. Print the solution x <strong>for</strong> each step of the Kalman filter<br />

and see how it changes. It should be close to the solution of the function with ɛ ≡ 0.<br />

Plot the results using gnuplot.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!