-
Notifications
You must be signed in to change notification settings - Fork 14
/
unittest_trig_basis_eval.m
37 lines (33 loc) · 1.28 KB
/
unittest_trig_basis_eval.m
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
30
31
32
33
34
35
36
37
function unittest_trig_basis_eval(varargin)
% UNITTEST_TRIG_BASIS_EVAL Test the TRIG_BASIS_EVAL function.
%
% Example (<a href="matlab:run_example unittest_trig_basis_eval">run</a>)
% unittest_trig_basis_eval
%
% See also TRIG_BASIS_EVAL, MUNIT_RUN_TESTSUITE
% Elmar Zander
% Copyright 2015, Inst. of Scientific Computing
%
% This program is free software: you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation, either version 3 of the License, or (at your
% option) any later version.
% See the GNU General Public License for more details. You should have
% received a copy of the GNU General Public License along with this
% program. If not, see <http://www.gnu.org/licenses/>.
munit_set_function( 'trig_basis_eval' );
tau = 2*pi;
a_k = [0.2; 0.3];
w_k_l = [2, 4; 8, 10] / tau;
p_k_l = [3, 5; 9, 11] / tau;
x_l_i = [ 60, 70, 80; 90, 100, 110];
y_k_i_ex = [
0.2 * sin(2*60+3)*sin(4*90+5), ...
0.2 * sin(2*70+3)*sin(4*100+5), ...
0.2 * sin(2*80+3)*sin(4*110+5);
0.3 * sin(8*60+9)*sin(10*90+11), ...
0.3 * sin(8*70+9)*sin(10*100+11), ...
0.3 * sin(8*80+9)*sin(10*110+11)
];
[y_k_i] = trig_basis_eval({w_k_l, p_k_l, a_k}, x_l_i);
assert_equals(y_k_i, y_k_i_ex, 'eval');