Example: Function call: log_sum(matrix_1).
matrix_1:
x1 |
x2 |
x3 |
x4 |
1 |
4 |
8 |
3 |
at point_1:
component_name |
value |
x1 x2 x3 x4 |
0.1 0.91 1.1 10 |
MATLAB code (.\Aorda\PSG\MATLAB\Examples\Functions\Func_value_log_sum.m) for function calculation:
%Calculation of functions with PSG Subroutine 'functionvalue'
%Define data:
H = [1 4 8 3];
a = [0.1;0.91;1.1;10];
%Calculate log_sum function at point 'a':
[val1] = functionvalue('log_sum', [], H, [], [], a);
%Display function value:
disp(sprintf('functionvalue = %g', val1));
%=======================================================================
%Calculation of functions with PSG Subroutine 'mpsg_function_value'
%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', H, [], [], []);
%Create the PSG point 'point_1'(structure containing header and matrix body) and pack it to structure 'iargstruc_arr':
iargstruc_arr(2) = point_pack('point_1', a', []);
%Calculate log_sum function at point 'point_1':
[val2] = mpsg_function_value('log_sum(matrix_1)','point_1',iargstruc_arr);
%Display function value:
disp(sprintf('mpsg_function_value = %g', val2));
Program output:
functionvalue = 4.99041
mpsg_function_value = 4.99041