Example: calculation of incremets of polynom_abs function with matrix.

 

matrix_1:

 

x1

x2

x4

scenario_benchmark

2

-3

1

-1

6

2

1

-7

1.5

15

-1

-1

 

point_1:

 

component_name

value

x1

x2

x4

1

1

1

 

MATLAB code (.\Aorda\PSG\MATLAB\Examples\Functions\Func_value_increment.m) for function calculation:

 

 

%Calculation of increments using 'functionincrement':

%Define data:

H1 = [2 -1 1;-3 6 -7;1 2 1.5];

c1 = [15;-1;-1];

a = [1;1;1];

%Calculate increments at point 'a':

point_1 = functionincrement('avg', [], H1, c1, [], a);

%Display result:

disp('Increments of average function at point ''a'' using ''functionincrement'' = ');

disp(point_1)

%=======================================================================

%Calculation of increments using 'mpsg_function_increment':

%Create the PSG matrix 'matrix_1'(structure containing header and matrix body) and pack it to structure 'iargstruc_arr':

iargstruc_arr(1) = matrix_pack('matrix_1', H1, [],  c1, []);

%Create the PSG point 'point_a'(structure containing header and matrix body) and pack it to structure 'iargstruc_arr':

iargstruc_arr(2) = point_pack('point_a', a, []);

%Calculate increments at point 'point_a':

point_2 = mpsg_function_increment('avg(matrix_1)','point_a',iargstruc_arr);

%Display result:

disp('Increments of average function at point ''point_a'' using ''mpsg_function_increment'' = ');

disp(point_2.values')

 

 

Program output:

 

Increments of average function at point 'a' using 'functionincrement' =

        0

  -2.3333

   1.5000

 

Increments of average function at point 'point_a' using 'mpsg_function_increment' =

        0

  -2.3333

   1.5000