Quadriga-Lib
C++/MEX/Python Utility library for radio channel modelling and simulations
MALAB / Octave API Documentation for Quadriga-Lib v0.11.5


Overview
Array antenna functions
Channel functions
Channel generation functions
Channel statistics
Miscellaneous / Tools
Site-specific simulation tools




Array antenna functions



arrayant_calc_beamwidth - Calculates the beam width of array antenna elements in degree
Usage:
% Input as struct (struct mode)
[ beamwidth_az, beamwidth_el, az_point_ang, el_point_ang ] = quadriga_lib.arrayant_calc_beamwidth( arrayant );

[ beamwidth_az, beamwidth_el, az_point_ang, el_point_ang ] = quadriga_lib.arrayant_calc_beamwidth( arrayant, i_element, threshold_dB );

% Separate inputs (split mode)
[ beamwidth_az, beamwidth_el, az_point_ang, el_point_ang ] = ...
    quadriga_lib.arrayant_calc_beamwidth( e_theta_re, e_theta_im, e_phi_re, e_phi_im, azimuth_grid, elevation_grid );

[ beamwidth_az, beamwidth_el, az_point_ang, el_point_ang ] = ...
    quadriga_lib.arrayant_calc_beamwidth( e_theta_re, e_theta_im, e_phi_re, e_phi_im, azimuth_grid, elevation_grid, i_element, threshold_dB );
Inputs (struct mode):
Inputs (split mode):
Output Arguments:
See also:


arrayant_calc_directivity - Calculates the directivity in dBi of array antenna elements
Usage:
% Input as struct (struct mode)
directivity = quadriga_lib.arrayant_calc_directivity(arrayant);
directivity = quadriga_lib.arrayant_calc_directivity(arrayant, i_element);

% Separate inputs (split mode)
directivity = quadriga_lib.arrayant_calc_directivity(e_theta_re, e_theta_im, e_phi_re, ...
    e_phi_im, azimuth_grid, elevation_grid);

directivity = quadriga_lib.arrayant_calc_directivity(e_theta_re, e_theta_im, e_phi_re, ...
    e_phi_im, azimuth_grid, elevation_grid, i_element);
Inputs (struct mode):
Inputs (split mode):
Output Argument:
See also:


arrayant_combine_pattern - Calculate effective radiation patterns for array antennas

Description:
An array antenna consists of multiple individual elements. Each element occupies a specific position relative to the array's phase-center, its local origin. Elements can also be inter-coupled, represented by a coupling matrix. By integrating the element radiation patterns, their positions, and the coupling weights, one can determine an effective radiation pattern observable by a receiver in the antenna's far field. Leveraging these effective patterns is especially beneficial in antenna design, beamforming applications such as in 5G systems, and in planning wireless communication networks in complex environments like urban areas. This streamlined approach offers a significant boost in computation speed when calculating MIMO channel coefficients, as it reduces the number of necessary operations. The function arrayant_combine_pattern is designed to compute these effective radiation patterns. Usage:
% Minimal example (input/output = struct)
arrayant_out = quadriga_lib.arrayant_combine_pattern(arrayant_in);

% Optional inputs: freq, azimuth_grid, elevation_grid
arrayant_out = quadriga_lib.arrayant_combine_pattern(arrayant_in, freq, azimuth_grid, elevation_grid);

% Separate outputs, struct input
[e_theta_re, e_theta_im, e_phi_re, e_phi_im, azimuth_grid, elevation_grid, element_pos, ...
    coupling_re, coupling_im, freq, name] = quadriga_lib.arrayant_combine_pattern(arrayant_in);

% Separate inputs
arrayant_out = quadriga_lib.arrayant_combine_pattern([], freq, azimuth_grid, elevation_grid, ...
    e_theta_re, e_theta_im, e_phi_re, e_phi_im, azimuth_grid, elevation_grid, element_pos, ...
    coupling_re, coupling_im, freq, name);
Examples:
The following example creates a unified linear array of 4 dipoles, spaced at half-wavelength. The elements are then coupled with each other (i.e., they receive the same signal). The effective pattern is calculated using arrayant_combine_pattern.
% Generate dipole pattern
ant = quadriga_lib.generate_arrayant('dipole');

% Duplicate 4 times
ant.e_theta_re  = repmat(ant.e_theta_re, [1,1,4]);
ant.e_theta_im  = repmat(ant.e_theta_im, [1,1,4]);
ant.e_phi_re    = repmat(ant.e_phi_re, [1,1,4]);
ant.e_phi_im    = repmat(ant.e_phi_im, [1,1,4]);
ant.element_pos = repmat(ant.element_pos, [1,4]);

% Set element positions and coupling matrix
ant.element_pos(2,:) = [ -0.75, -0.25, 0.25, 0.75];  % lambda, along y-axis
ant.coupling_re = [ 1 ; 1 ; 1 ; 1 ]/sqrt(4);
ant.coupling_im = [ 0 ; 0 ; 0 ; 0 ];

% Calculate effective pattern
ant_c = quadriga_lib.arrayant_combine_pattern( ant );

% Plot gain
plot( ant.azimuth_grid*180/pi, [ 10*log10( ant.e_theta_re(91,:,1).^2 ); 10*log10( ant_c.e_theta_re(91,:).^2 ) ]);
axis([-180 180 -20 15]); ylabel('Gain (dBi)'); xlabel('Azimth angle (deg)'); legend('Dipole','Array')
Input Arguments:
Output Arguments:


arrayant_copy_element - Create copies of array antenna elements

Usage:
arrayant_out = quadriga_lib.arrayant_copy_element(arrayant_in, source_element, dest_element);
Input Arguments:
Output Arguments:


arrayant_export_obj_file - Creates a Wavefront OBJ file for visualizing the shape of the antenna pattern

Usage:
quadriga_lib.arrayant_export_obj_file( fn, arrayant, directivity_range, colormap, ...
                object_radius, icosphere_n_div, i_element );
Input Arguments:


arrayant_generate - Generates predefined array antenna models
Usage:
% Simple antennas (v-pol)
ant = quadriga_lib.arrayant_generate('omni', res);
ant = quadriga_lib.arrayant_generate('dipole', res);
ant = quadriga_lib.arrayant_generate('half-wave-dipole', res);

% Cross-polarized isotropic
ant = quadriga_lib.arrayant_generate('xpol', res);

% Custom 3dB beamwidth
ant = quadriga_lib.arrayant_generate('custom', res, freq, az_3dB, el_3dB, rear_gain_lin);

% Uniform linear array (N horizontal elements, half-wavelength spacing by default)
ant = quadriga_lib.arrayant_generate('ula', res, freq, [], [], [], [], N, pol, [], spacing);

% Uniform linear array with custom per-element pattern struct
ant = quadriga_lib.arrayant_generate('ula', res, freq, [], [], [], [], N, [], [], spacing, ...
                                     [], [], [], [], pattern);

% 3GPP-NR array (default 3GPP element pattern)
ant = quadriga_lib.arrayant_generate('3GPP', res, freq, [], [], [], 
                                     M, N, pol, tilt, spacing, Mg, Ng, dgv, dgh);

% 3GPP-NR array with custom element beamwidth
ant = quadriga_lib.arrayant_generate('3GPP', res, freq, az_3dB, el_3dB, rear_gain_lin, ...
                                     M, N, pol, tilt, spacing, Mg, Ng, dgv, dgh);

% 3GPP-NR array with custom per-element pattern struct
ant = quadriga_lib.arrayant_generate('3GPP', res, freq, [], [], [], ...
                                     M, N, pol, tilt, spacing, Mg, Ng, dgv, dgh, pattern);

% Multi-beam M×N array (one combined beam / one beam per direction)
ant = quadriga_lib.arrayant_generate('multibeam', res, freq, az_3dB, el_3dB, rear_gain_lin, ...
                                     M, N, pol, beam_angles, spacing);
ant = quadriga_lib.arrayant_generate('multibeam_sep', res, freq, az_3dB, el_3dB, rear_gain_lin, ...
                                     M, N, pol, beam_angles, spacing);

% Separate outputs (must request exactly 11)
[e_theta_re, e_theta_im, e_phi_re, e_phi_im, azimuth_grid, elevation_grid, ...
    element_pos, coupling_re, coupling_im, center_freq, name] = quadriga_lib.arrayant_generate( ... );
Inputs (common):
Inputs (type custom, 3GPP, multibeam, multibeam_sep):
Inputs (type ula, 3GPP, multibeam, multibeam_sep):
Inputs (type 3GPP only):
Inputs (type ula, 3GPP):
Inputs (type multibeam, multibeam_sep):
Outputs:


arrayant_interpolate - Interpolate polarimetric array antenna field patterns (single- and multi-frequency)
Usage:
% Single-frequency, struct input
[V_re, V_im, H_re, H_im, dist, azimuth_loc, elevation_loc, gamma] = ...
    quadriga_lib.arrayant_interpolate( arrayant, azimuth, elevation, element, orientation, element_pos );

% Single-frequency, separate arrayant inputs
[V_re, V_im, H_re, H_im, dist, azimuth_loc, elevation_loc, gamma] = ...
    quadriga_lib.arrayant_interpolate( [], azimuth, elevation, element, orientation, element_pos, [], ...
    e_theta_re, e_theta_im, e_phi_re, e_phi_im, azimuth_grid, elevation_grid );

% Multi-frequency, struct array input
[V_re, V_im, H_re, H_im] = ...
    quadriga_lib.arrayant_interpolate( arrayant_multi, azimuth, elevation, element, orientation, element_pos, freq );
Inputs:
Inputs (separate arrayant data, required when `arrayant` is `[]`, single-frequency only):
Derived sizes:
n_azimuth Number of azimuth samples in the pattern
n_elevation Number of elevation samples in the pattern
n_elements Number of antenna elements in the pattern
n_ang Number of interpolation angles
n_out Number of output elements (n_elements if element is empty, else numel(element))
n_freq Number of target frequencies (multi-frequency mode only)

Outputs:
See also:


arrayant_qdant_read - Reads array antenna data from QDANT files
Usage:
% Multi-frequency read (struct array, all entries)
[ ant, layout ] = quadriga_lib.arrayant_qdant_read( fn );

% Single-frequency read (struct output)
[ ant, layout ] = quadriga_lib.arrayant_qdant_read( fn, id );

% Single-frequency read (separate fields)
[ e_theta_re, e_theta_im, e_phi_re, e_phi_im, azimuth_grid, elevation_grid, element_pos, ...
    coupling_re, coupling_im, center_freq, name, layout ] = quadriga_lib.arrayant_qdant_read( fn, id );
Inputs:
Outputs:
See also:


arrayant_qdant_write - Writes array antenna data to QDANT files
Usage:
% Arrayant as struct
id_in_file = quadriga_lib.arrayant_qdant_write( fn, arrayant, id, layout );

% Arrayant as separate inputs
id_in_file = quadriga_lib.arrayant_qdant_write( fn, [], id, layout, e_theta_re, e_theta_im, e_phi_re, ...
    e_phi_im, azimuth_grid, elevation_grid, element_pos, coupling_re, coupling_im, center_freq, name );
Inputs:
Inputs (separate arrayant data, required when `arrayant` is `[]`):
Outputs:
See also:


arrayant_rotate_pattern - Rotates antenna patterns

Description:
This MATLAB function transforms the radiation patterns of array antenna elements, allowing for precise rotations around the three principal axes (x, y, z) of the local Cartesian coordinate system. This is essential in antenna design and optimization, enabling engineers to tailor the radiation pattern for enhanced performance. The function also adjusts the sampling grid for non-uniformly sampled antennas, such as parabolic antennas with small apertures, ensuring accurate and efficient computations. The 3 rotations are applies in the order: 1. rotation around the x-axis (bank angle); 2. rotation around the y-axis (tilt angle), 3. rotation around the z-axis (heading angle) Usage:
% Minimal example (input/output = struct)
arrayant_out = quadriga_lib.arrayant_rotate_pattern(arrayant_in, bank, tilt, head, usage, element);

% Separate outputs, struct input
[e_theta_re, e_theta_im, e_phi_re, e_phi_im, azimuth_grid, elevation_grid, element_pos, ...
    coupling_re, coupling_im, freq, name] = quadriga_lib.arrayant_rotate_pattern(arrayant_in, ...
    bank, tilt, head, usage, element);

% Separate inputs
arrayant_out = quadriga_lib.arrayant_rotate_pattern([], bank, tilt, head, usage, element, ...
    e_theta_re, e_theta_im, e_phi_re, e_phi_im, azimuth_grid, elevation_grid, element_pos, ...
    coupling_re, coupling_im, freq, name);
Input Arguments:
Output Arguments:


generate_speaker - Generate a parametric frequency-dependent loudspeaker directivity model

Description:
Usage:
arrayant = quadriga_lib.generate_speaker( driver_type, radius, lower_cutoff, upper_cutoff, ...
    lower_rolloff_slope, upper_rolloff_slope, sensitivity, radiation_type, hor_coverage, ...
    ver_coverage, horn_control_freq, baffle_width, baffle_height, frequencies, ...
    angular_resolution );
Inputs:
Outputs:




Channel functions



baseband_freq_response - Transforms the channel into frequency domain and returns the frequency response

Usage:
[ hmat_re, hmat_im ] = quadriga_lib.baseband_freq_response( coeff_re, coeff_im, delay, pilot_grid, bandwidth, i_snap );
Input Arguments:
Output Argument:


channel_export_obj_file - Export path data to a Wavefront OBJ file for visualization in Blender

Description:
This function exports path data to a Wavefront OBJ file, which can be used for visualization in 3D software such as Blender. It supports various colormaps for color-coding the paths based on their gain values. In addition, the function allows you to control the maximum number of paths displayed, set gain thresholds for color-coding and selection. Usage:
quadriga_lib.channel_export_obj_file( fn, max_no_paths, gain_max, gain_min, colormap, radius_max,
    radius_min, n_edges, rx_position, tx_position, no_interact, interact_coord, center_freq,
    coeff_re, coeff_im, i_snap )
Input Arguments:
Output Argument:
This function does not return a value. It writes the OBJ file directly to disk.


hdf5_create_file - Create a new HDF5 channel file with a custom storage layout

Description:
Quadriga-Lib offers an HDF5-based method for storing and managing channel data. A key feature of this library is its ability to organize multiple channels within a single HDF5 file while enabling access to individual data sets without the need to read the entire file. In this system, channels can be structured in a multi-dimensional array. For instance, the first dimension might represent the Base Station (BS), the second the User Equipment (UE), and the third the frequency. However, it is important to note that the dimensions of the storage layout must be defined when the file is initially created and cannot be altered thereafter. The function quadriga_lib.hdf5_create_file is used to create an empty file with a predetermined custom storage layout. Usage:
quadriga_lib.hdf5_create_file( fn, storage_dims );
Input Arguments:


hdf5_read_channel - Reads channel data from HDF5 files

Description:
Quadriga-Lib provides an HDF5-based solution for storing and organizing channel data. This data comprises various well-defined sets, including channel coefficients, positions of transmitters and receivers, as well as path data that reflects the interaction of radio waves with the environment. Typically, these datasets are multi-dimensional, encompassing data for n_rx receive antennas, n_tx transmit antennas, n_path propagation paths, and n_snap snapshots. Snapshots are particularly useful for recording data across different locations (such as along a trajectory) or various frequencies. It is important to note that not all datasets include all these dimensions.

The library also supports the addition of extra datasets of any type or shape, which can be useful for incorporating descriptive data or analysis results. To facilitate data access, the function quadriga_lib.hdf5_read_channel is designed to read both structured and unstructured data from the file. Usage:
[ par, rx_position, tx_position, coeff_re, coeff_im, delay, center_freq, name, initial_pos, ...
   path_gain, path_length, path_polarization, path_angles, path_fbs_pos, path_lbs_pos, no_interact, ...
   interact_coord, rx_orientation, tx_orientation ] = quadriga_lib.hdf5_read_channel( fn, location, snap );
Input Arguments:
Output Arguments:
Caveat:


hdf5_read_dset - Read a single unstructured dataset from an HDF5 file

Description:
Quadriga-Lib offers a solution based on HDF5 for storing and organizing channel data. In addition to structured datasets, the library facilitates the inclusion of extra datasets of various types and shapes. This feature is particularly beneficial for integrating descriptive data or analysis results. The function quadriga_lib.hdf5_read_dset retrieves a single unstructured dataset. The output type of the function is defined by the datatype in the file. An empty matrix is returned if the dataset does not exist in the file. Usage:
dset = quadriga_lib.hdf5_read_dset( fn, location, name );
Input Arguments:
Output Argument:


hdf5_read_dset_names - Read the names of unstructured data fields from an HDF5 file

Description:
Quadriga-Lib offers a solution based on HDF5 for storing and organizing channel data. In addition to structured datasets, the library facilitates the inclusion of extra datasets of various types and shapes. This feature is particularly beneficial for integrating descriptive data or analysis results. Users can add any number of such unstructured datasets, each identified by a unique dataset name. The function quadriga_lib.hdf5_read_dset_names retrieves the names of all these datasets, returning them as a cell array of strings. Usage:
names = quadriga_lib.hdf5_read_dset_names( fn, location );
Input Arguments:
Output Argument:


hdf5_read_layout - Read the storage layout of channel data inside an HDF5 file

Description:
Quadriga-Lib provides an HDF5-based solution for the storage and organization of channel data. A notable feature of this library is its capacity to manage multiple channels within a single HDF5 file. In this framework, channels can be arranged in a multi-dimensional array format. The function quadriga_lib.hdf5_read_layout is designed to read the storage layout from an existing file. Furthermore, it also generates an array that marks the locations within the layout where data already exists. This functionality aids in efficiently managing and accessing channel data within the HDF5 file structure. Usage:
[ storage_dims, has_data ] = quadriga_lib.hdf5_read_layout( fn );
Input Argument:
Output Arguments:


hdf5_reshape_layout - Reshapes the storage layout inside an existing HDF5 file

Description:
Quadriga-Lib provides an HDF5-based solution for the storage and organization of channel data. A notable feature of this library is its capacity to manage multiple channels within a single HDF5 file. In this framework, channels can be arranged in a multi-dimensional array format. Once an HDF5 file has been created, the number of channels in the storage layout is fixed. However, it is possible to reshape the layout using quadriga_lib.hdf5_reshape_layout. Usage:
quadriga_lib.hdf5_reshape_layout( fn, storage_dims );
Input Arguments:


hdf5_write_channel - Writes channel data to HDF5 files

Description:
Quadriga-Lib provides an HDF5-based solution for storing and organizing channel data. This function can be used to write structured and unstructured data to an HDF5 file. Usage:
storage_dims = quadriga_lib.hdf5_write_channel( fn, location, par, rx_position, tx_position, ...
   coeff_re, coeff_im, delay, center_freq, name, initial_pos, path_gain, path_length, ...
   path_polarization, path_angles, path_fbs_pos, path_lbs_pos, no_interact, interact_coord, ...
   rx_orientation, tx_orientation )
Input Arguments:
Output Arguments:
Caveat:


hdf5_write_dset - Writes unstructured data to a HDF5 file

Description:
Quadriga-Lib offers a solution based on HDF5 for storing and organizing channel data. In addition to structured datasets, the library facilitates the inclusion of extra datasets of various types and shapes. This feature is particularly beneficial for integrating descriptive data or analysis results. The function quadriga_lib.hdf5_write_dset writes a single unstructured dataset. Usage:
storage_dims = quadriga_lib.hdf5_write_dset( fn, location, name, data );
Input Arguments:
Output Argument:
Caveat:


qrt_file_parse - Read metadata from a QRT file
Usage:
[ no_cir, no_orig, no_dest, no_freq, cir_offset, orig_names, dest_names, version, freq, ...
     cir_pos, cir_orientation, orig_pos, orig_orientation ] = quadriga_lib.qrt_file_parse( fn );
Input Arguments:
Output Arguments:


qrt_file_read - Read ray-tracing CIR data from a QRT file
Usage:
[ center_freq, tx_pos, tx_orientation, rx_pos, rx_orientation, fbs_pos, lbs_pos, path_gain, ...
    path_length, M, aod, eod, aoa, eoa, path_coord, no_int, coord ] = ...
    quadriga_lib.qrt_file_read( fn, i_cir, i_orig, downlink, normalize_M );
Input Arguments:
Output Arguments:
See also:


quantize_delays - Fixes the path delays to a grid of delay bins

Description:
Usage:
[ coeff_re_q, coeff_im_q, delay_q ] = quadriga_lib.quantize_delays( coeff_re, coeff_im, delay, ...
    tap_spacing, max_no_taps, power_exponent, fix_taps );
Input Arguments:
Output Arguments:




Channel generation functions



get_channels_ieee_indoor - Generate indoor MIMO channel realizations for IEEE TGn/TGac/TGax/TGah models
Usage:
chan = quadriga_lib.get_channels_ieee_indoor( ap_array, sta_array, ChannelType, CarrierFreq_Hz, ...
   tap_spacing_s, n_users, observation_time, update_rate, speed_station_kmh, speed_env_kmh, ...
   Dist_m, n_floors, uplink, offset_angles, n_subpath, Doppler_effect, seed, ...
   KF_linear, XPR_NLOS_linear, SF_std_dB_LOS, SF_std_dB_NLOS, dBP_m, n_walls, wall_loss );
Inputs:
Output:
See also:


get_channels_irs - Calculate channel coefficients for intelligent reflective surfaces (IRS)

Description:
Usage:
[ coeff_re, coeff_im, delays, active_path, aod, eod, aoa, eoa ] = quadriga_lib.get_channels_irs( ...
    ant_tx, ant_rx, ant_irs, ...
    fbs_pos_1, lbs_pos_1, path_gain_1, path_length_1, M_1, ...
    fbs_pos_2, lbs_pos_2, path_gain_2, path_length_2, M_2, ...
    tx_pos, tx_orientation, rx_pos, rx_orientation, irs_pos, irs_orientation, ...
    i_irs, threshold_dB, center_freq, use_absolute_delays, active_path,  ant_irs_2 );
Input Arguments:
Output Arguments:


get_channels_planar - Calculate MIMO channel coefficients for planar wave paths
Usage:
[ coeff_re, coeff_im, delays, rx_Doppler ] = quadriga_lib.get_channels_planar( tx_array, rx_array, ...
    aod, eod, aoa, eoa, path_gain, path_length, M, tx_pos, tx_orientation, rx_pos, rx_orientation, ...
    center_freq, use_absolute_delays, add_fake_los_path );
Input Arguments:
Output Arguments:
See also:


get_channels_spherical - Calculate MIMO channel coefficients and delays for spherical wave propagation
Usage:
[ coeff_re, coeff_im, delays, aod, eod, aoa, eoa ] = quadriga_lib.get_channels_spherical( tx_array, rx_array, ...
    fbs_pos, lbs_pos, path_gain, path_length, M, tx_pos, tx_orientation, rx_pos, rx_orientation, ...
    center_freq, use_absolute_delays, add_fake_los_path, use_avx2 );
Inputs:
Outputs:
See also:




Channel statistics



acdf - Calculate the empirical averaged cumulative distribution function (CDF)
Usage:
[ cdf_per_set, bins_out, cdf_avg, mu, sig ] = quadriga_lib.acdf( data, bins_in, n_bins );
Inputs:
Outputs:


calc_angular_spread - Calculate azimuth and elevation angular spreads with spherical wrapping
Usage:
[ as, es, orientation, phi, theta ] = quadriga_lib.calc_angular_spread( az, el, powers, ...
    wrapping, calc_bank_angle, quantize );
Inputs:
Outputs:


calc_cross_polarization_ratio - Calculate the cross-polarization ratio (XPR) for linear and circular polarization bases
Usage:
[ xpr, pg ] = quadriga_lib.calc_cross_polarization_ratio( powers, M, path_length, ...
    tx_pos, rx_pos, include_los, window_size );
Inputs:
Outputs:


calc_delay_spread - Calculates RMS delay spread from per-CIR delays and linear-scale powers
Usage:
[ ds, mean_delay ] = quadriga_lib.calc_delay_spread( delays, powers, threshold, granularity );
Inputs:
Outputs:
See also:


calc_rician_k_factor - Calculate the Rician K-Factor from channel impulse response data
Usage:
[ kf, pg ] = quadriga_lib.calc_rician_k_factor( powers, path_length, tx_pos, rx_pos, window_size );
Inputs:
Outputs:




Miscellaneous / Tools



calc_rotation_matrix - Calculates a 3x3 rotation matrix from a 3-element orientation vector

Description:
In linear algebra, a rotation matrix is a transformation matrix that is used to perform a rotation in Euclidean space. The rotation of a rigid body (or three-dimensional coordinate system with a fixed origin) is described by a single rotation about some axis. Such a rotation may be uniquely described by three real-valued parameters. The idea behind Euler rotations is to split the complete rotation of the coordinate system into three simpler constitutive rotation. This function calculates the 3x3 rotation matrix R from the intrinsic Euler angles. Usage:
rotation = quadriga_lib.calc_rotation_matrix( orientation, invert_y_axis, transpose )
Example:
The following example obtains the 3x3 matrix R for a 45 degree rotation around the z-axis:
bank    = 0;
tilt    = 0;
heading = 45 * pi/180;
orientation = [ bank; tilt; heading ];
rotation = quadriga_lib.calc_rotation_matrix( orientation );
R = reshape( rotation, 3, 3 );
Input Arguments:
Output Argument:


cart2geo - Convert elementwise Cartesian coordinates to azimuth/elevation angles and vector length
Usage:
[ az, el, len ] = quadriga_lib.cart2geo( x, y, z, use_kernel );
Inputs:
Outputs:


fast_sincos - Fast, approximate sine/cosine for MATLAB numeric arrays

Description:
Computes elementwise sine and/or cosine for input angles in radians. Usage:
[s, c] = arrayant_lib.fast_sincos(x);
s = arrayant_lib.fast_sincos(x);
c = arrayant_lib.fast_sincos(x, true);
Input Arguments:
Output Arguments:
Examples:
% Input as single for best performance
x = single(linspace(0, 2*pi, 1000));

% Compute sine and cosine
[s, c] = arrayant_lib.fast_sincos(x);

% Compute only sine (single output)
s = arrayant_lib.fast_sincos(x);

% Compute only cosine (single output with flag)
c = arrayant_lib.fast_sincos(x, true);

% Double input is accepted; outputs remain single
xd = linspace(0, 2*pi, 8);
s_only = arrayant_lib.fast_sincos(xd);        % class(s_only) == 'single'
c_only = arrayant_lib.fast_sincos(xd, true);  % class(c_only) == 'single'


geo2cart - Convert elementwise azimuth/elevation angles to Cartesian coordinates
Usage:
split = true;
[ x, y, z, sAZ, cAZ, sEL, cEL ] = quadriga_lib.fast_geo2cart( az, el, len, use_kernel, split );

split = false;
cart = quadriga_lib.fast_geo2cart( az, el, len, use_kernel, split );
Inputs:
Outputs:


interp - 2D and 1D linear interpolation.

Description:
This function implements 2D and 1D linear interpolation. Usage:
dataI = quadriga_lib.interp( x, y, data, xI, yI );      % 2D case

dataI = quadriga_lib.interp( x, [], data, xI );         % 1D case
Input Arguments:
Output Arguments:


version - Returns the quadriga-lib version number

Usage:
version = quadriga_lib.version;
Caveat:


write_png - Write data to a PNG file

Description:
Declaration:
quadriga_lib.write_png( fn, data, colormap, min_val, max_val, log_transform )
Arguments:




Site-specific simulation tools



calc_diffraction_gain - Calculate diffraction gain for multiple TX-RX pairs using a 3D triangular mesh
Usage:
[ gain, coord ] = quadriga_lib.calc_diffraction_gain( orig, dest, mesh, mtl_prop, ...
    center_frequency, lod, verbose, sub_mesh_index, use_kernel, gpu_id );
Inputs:
Outputs:
See also:


generate_diffraction_paths - Generate elliptic propagation paths and weights for diffraction gain estimation
Usage:
[ rays, weights ] = quadriga_lib.generate_diffraction_paths( orig, dest, center_frequency, lod );
Inputs:
Outputs:
See also:


icosphere - Construct a geodesic polyhedron from recursive icosahedron subdivision
Usage:
[ center, length, vert, direction ] = quadriga_lib.icosphere( n_div, radius, direction_xyz );
Inputs:
Outputs:


obj_file_read - Read a Wavefront .obj file and extract geometry and material information
Usage:
[ mesh, mtl_prop, vert_list, face_ind, obj_ind, mtl_ind, obj_names, mtl_names, bsdf ] = ...
    quadriga_lib.obj_file_read( fn );

% Use a custom material definition file
[ mesh, mtl_prop, vert_list, face_ind, obj_ind, mtl_ind, obj_names, mtl_names, bsdf ] = ...
    quadriga_lib.obj_file_read( fn, materials_csv );
Inputs:
Outputs:
Default material table:


point_cloud_aabb - Compute the axis-aligned bounding boxes (AABB) of a 3D point cloud
Usage:
aabb = quadriga_lib.point_cloud_aabb( points, sub_cloud_index, vec_size );
Inputs:
Outputs:
See also:


point_cloud_segmentation - Reorganize a point cloud into spatial sub-clouds for efficient processing
Usage:
[ pointsR, sub_cloud_index, forward_index, reverse_index ] = ...
    quadriga_lib.point_cloud_segmentation( points, target_size, vec_size );
Inputs:
Outputs:


point_inside_mesh - Test whether 3D points are inside a triangle mesh using raycasting
Usage:
result = quadriga_lib.point_inside_mesh( points, mesh, obj_ind, distance );
Inputs:
Output:


ray_mesh_interact - Calculates reflection, transmission, or refraction of EM/acoustic waves at mesh surfaces

Description:
Usage:
[ origN, destN, gainN, xprmatN, trivecN, tridirN, orig_lengthN, fbs_angleN, thicknessN, edge_lengthN, ...
    normal_vecN, out_typeN ] = quadriga_lib.ray_mesh_interact( interaction_type, center_frequency, ...
    orig, dest, fbs, sbs, mesh, mtl_prop, fbs_ind, sbs_ind, trivec, tridir, orig_length );
Inputs:
Outputs:


ray_point_intersect - Calculate intersections of ray beams with points in 3D space
Usage:
[ hit_count, ray_ind ] = quadriga_lib.ray_point_intersect( orig, trivec, tridir, points, ...
    sub_cloud_index, use_kernel, gpu_id );
Inputs:
Outputs:
See also:


ray_triangle_intersect - Compute ray-triangle intersections in 3D using the Möller–Trumbore algorithm
Usage:
[ fbs, sbs, no_interact, fbs_ind, sbs_ind ] = quadriga_lib.ray_triangle_intersect( ...
    orig, dest, mesh, sub_mesh_index, aabb, use_kernel, gpu_id );
Inputs:
Outputs:
See also:


subdivide_triangles - Subdivide triangles into smaller triangles
Usage:
[ triangles_out, mtl_prop_out ] = quadriga_lib.subdivide_triangles( triangles_in, n_div, mtl_prop_in );
Inputs:
Outputs:


triangle_mesh_aabb - Calculate the axis-aligned bounding box (AABB) of a triangle mesh and its sub-meshes
Usage:
aabb = quadriga_lib.triangle_mesh_aabb( mesh, sub_mesh_index, vec_size );
Inputs:
Output:
See also:


triangle_mesh_segmentation - Reorganize a 3D triangular mesh into spatially clustered sub-meshes for faster processing
Usage:
[ triangles_out, sub_mesh_index, mesh_index, mtl_prop_out ] = ...
    quadriga_lib.triangle_mesh_segmentation( triangles_in, target_size, vec_size, mtl_prop_in );
Inputs:
Outputs: