NiHu  2.0
rayleigh_integral_3d_test.m
1 %// circular radiator with radius R = 1, divided into 15 elements along the radius.
2 radiator = create_circle(1, 15);
3 %// rectangular field point mesh, defined by 4 corners and division parameters.
4 field = create_slab([-2 0 .1; 2 0 .1; 2 0 4.1; -2 0 4.1], [40 40]);
5 
6 %// extract the mesh description matrices
7 [r_nodes, r_elem] = extract_core_mesh(radiator);
8 [f_nodes, f_elem] = extract_core_mesh(field);
9 
10 %// call C++ code at wave number k = 10
11 [Z_trans, Z_rad] = rayleigh_integral_3d(r_nodes, r_elem, f_nodes, f_elem, 10);
12 
13 %// constant velocity over the radiator
14 vn = ones(size(Z_trans,2),1);
15 %// radiated pressure computed by matrix multiplication
16 pf = Z_trans * vn;
17 pr = Z_rad * vn;
18 
19 %// plot results
20 figure;
21 plot_mesh(radiator, 20*log10(abs(pr)));
22 plot_mesh(field, 20*log10(abs(pf)));
23