rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
init_values_waveproduct.m
Go to the documentation of this file.
1 function U0 = init_values_waveproduct(glob, params)
2 % function U0 = init_values_waveproduct(glob, params)
3 % product of two sinus waves in both coordinate directions
4 %
5 % computes a product of axis-dependent waves of values between 'c_init_min'
6 % and 'c_init_max'
7 %
8 % required fields of params:
9 % c_init_max : maximum value in field
10 % c_init_min : minimum value in field
11 % c_init_freq_x : frequency in x-direction
12 % c_init_freq_y : frequency in y-direction
13 % c_init_phase_x : phase shift
14 % c_init_phase_y : phase shift
15 
16 % glob column check
17 if params.debug
18  if ~isempty(glob) && size(glob,1) < size(glob,2)
19  warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
20  if params.debug > 2
21  keyboard;
22  end
23  end
24 end
25 if nargin ~= 2
26  error('wrong number of parameters!');
27 end;
28 
29 decomp_mode = params.decomp_mode;
30 
31 % if ismember('c_init_freq_x',params.mu_names) | ...
32 % ismember('c_init_freq_y',params.mu_names) | ...
33 % ismember('c_init_min',params.mu_names) | ...
34 % ismember('c_init_max',params.mu_names) | ...
35 % ismember('c_init_phase_x',params.mu_names) | ...
36 % ismember('c_init_phase_y',params.mu_names)
37 % error('affine decomp with respect to mu_names not possible!');
38 % end;
39 
40 if decomp_mode == 2
41  U0 = 1;
42 else
43  X = glob(:,1);
44  Y = glob(:,2);
45 
46  Uinit = params.c_init_min + ...
47  (params.c_init_max-params.c_init_min) * ...
48  0.5 * (sin_sym(params.c_init_freq_x * X(:) + params.c_init_phase_x) ...
49  .* sin_sym(params.c_init_freq_y * Y(:) + params.c_init_phase_y) ...
50  + 1);
51  if decomp_mode == 0
52  U0 = Uinit;
53  elseif decomp_mode == 1
54  U0 = {Uinit};
55  end
56 end
57 %| \docupdate
function U0 = init_values_waveproduct(glob, params)
product of two sinus waves in both coordinate directions