Example: Function call: meanabs_nd_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 |
8.93784 -0.25271 -1.27649 -0.77983 -0.3662 |
-0.25271 9.64713 -1.60709 -0.15443 3.7164 |
-1.27649 -1.60709 4.91926 -2.73949 -0.4274 |
-0.77983 -0.15443 -2.73949 7.44517 -0.39033 |
-0.3662 3.7164 -0.4274 -0.39033 9.26 |
MATLAB code (..\Aorda\PSG\MATLAB\Examples\Func_value_meanabs_nd_err.m) for function minimization:
%Define data:
H1 = [1 4 8 3];
c1 = -2;
H2 = [8.93784 -0.25271 -1.27649 -0.77983;-0.25271 9.64713 -1.60709 -0.15443;-1.27649 -1.60709 4.91926 -2.73949;-0.77983 -0.15443 -2.73949 7.44517;-0.3662 3.7164 -0.4274 -0.39033];
c2 = [-0.3662;3.7164;-0.4274;-0.39033;9.26];
%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_nd_err(matrix_1,matrix_2)',...
'');
%Minimize meansquare_nd_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_nd_err function value = %g', val(1)));
disp(' ')
disp(sprintf('Pseudo R2 = %g', val(2)));
disp(' ')
disp('Contributions (normed increments) = ');
disp(output{2})
Program output:
meanabs_nd_err function value = 2.276
Pseudo R2 = 0.0625966
Contributions (normed increments) =
0.0126 0.2430 0.6636 0.0808