Project

General

Profile

Download (2.5 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 fmod (x,y: real) returns (z: real) prototype C lib m;
35

    
36
function exp_scalar_real (x: real) returns (y: real) prototype C lib m;
37
function log_scalar_real (x: real) returns (y: real) prototype C lib m;
38
function _10u_scalar_real (x: real) returns (y: real) prototype C lib m;
39
function log10_scalar_real (x: real) returns (y: real) prototype C lib m;
40

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

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

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

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