Project

General

Profile

Download (2.44 KB) Statistics
| Branch: | Tag: | Revision:
1
(*
2
Mathematical functions in Simulink Math Function blocks
3

    
4
All these functions can be applied to scalar value. All but transpose and
5
hermitian can be also applied as element-wise operations on vector, matrices
6
inputs. transpose and hermitian are applied on vector and matrices as regular
7
(non element-wise) operations.
8

    
9
The Lustre library provides only scalar functions for all cases, and, in the future,
10
the matrix versions of them.
11

    
12
exp: 
13
log
14
10^u
15
log10
16
magnitude^2
17
square
18
pow
19
conj
20
reciprocal
21
hypot
22
rem
23
mod
24
transpose
25
hermitian
26

    
27
For the moment, we focus only on theoretical types: real, complex.
28
A future version can be specialized for concrete datatypes (single, double,
29
(u)intXX).
30

    
31
*)
32

    
33
-- open <math>
34
function exp_scalar_real (x: real) returns (y: real) prototype C lib m;
35
function log_scalar_real (x: real) returns (y: real) prototype C lib m;
36
function _10u_scalar_real (x: real) returns (y: real) prototype C lib m;
37
function log10_scalar_real (x: real) returns (y: real) prototype C lib m;
38

    
39
-- complex modulus: |x|^2
40
function magnitude_2_scalar_real (x: real) returns (y: real) prototype C lib m;
41
function square_scalar_real (x: real) returns (y: real) prototype C lib m;
42
function pow_scalar_real (x,y: real) returns (z: real) prototype C lib m;
43
function conj_scalar_real (x: real) returns (y: real) prototype C lib m;
44
function reciprocal_scalar_real (x: real) returns (y: real) prototype C lib m;
45
function hypot_scalar_real (x,y: real) returns (z: real) prototype C lib m;
46

    
47
function rem_scalar_real_int_int_int (x,y: int) returns (z: int) prototype C lib m;
48
function rem_scalar_real_double_double_double (x,y: real) returns (z: real) prototype C lib m;
49
function rem_scalar_real_double_int_double (x: real; y: int) returns (z: real) prototype C lib m;
50
function rem_scalar_real_int_double_double (x: int; y: real) returns (z: real) prototype C lib m;
51

    
52
function mod_scalar_real_int_int_int (x,y: int) returns (z: int) prototype C lib m;
53
function mod_scalar_real_double_double_double (x,y: real) returns (z: real) prototype C lib m;
54
function mod_scalar_real_double_int_double (x: real; y: int) returns (z: real) prototype C lib m;
55
function mod_scalar_real_int_double_double (x: int; y: real) returns (z: real) prototype C lib m;
56

    
57
(*
58
-- function transpose_scalar_real (x: real) returns (y: real) prototype C lib m;
59
-- function hermitian_scalar_real (x: real) returns (y: real) prototype C lib m;
60
-- function exp_matrix_real (const i,j: int; x: real^i^j) returns (y: real^i^j) prototype C lib m;
61
*)
(16-16/16)