Example: Function call:   meanabs_ni_err(matrix_1,matrix_2).

 

matrix_1:

 

x1

x2

x3

x4

scenario_benchmark

1

4

8

3

-2

 

matrix_2:

 

x1

x2

x3

x4

scenario_benchmark

11

3

2

0

9

 

MATLAB code (.\Aorda\PSG\MATLAB\Examples\Func_value_meanabs_ni_err.m) for function minimization:

 

%Define data:

H1 = [1 4 8 3];

c1 = -2;

H2 = [11 3 2 0];

c2 = 9;

 

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

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

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

iargstruc_arr(2) = tbpsg_matrix_pack('matrix_2', H2, [],  c2);

 

%Create problem statement:

problem_statement = sprintf('%s\n',...

'  minimize',...  

'  meansquare_ni_err(matrix_1,matrix_2)',...

'');

 

%Minimize meansquare_ni_err function:

[solution_str, outargstruc_arr] = tbpsg_run(problem_statement, iargstruc_arr);

%Extract value of function from solution report:

val = tbpsg_function_data(solution_str, outargstruc_arr);

%Extract values of output points:

output = tbpsg_point_data(solution_str, outargstruc_arr);

%Display function value:

disp(' ')

disp(sprintf('meansquare_ni_err function value = %g', val(1)));

disp(' ')

disp('Contributions (normed increments) = ');

disp(output{2})

 

 

Program output:

 

meanabs_ni_err function value = 2.39365

 

Contributions (normed increments) =

   0.0000    0.0000    0.0000    1.0000