Example: Function call: wcvar_ni(0.8, matrix_1, matrix_2). Parameter = 0.8 and matrix_1:
s1 |
s2 |
s3 |
s4 |
s5 |
s6 |
s7 |
s8 |
-1 |
-31 |
14 |
21 |
5 |
9 |
-5 |
1 |
matrix_2:
s1 |
s2 |
s3 |
s4 |
s5 |
s6 |
s7 |
s8 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
at point_1:
component_name |
value |
s1 s2 s3 s4 s5 s6 s7 s8 |
0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 |
Example: calculation of wcvar_ni function with parameter 0.8 and matrix:
MATLAB code (.\Aorda\PSG\MATLAB\Examples\Functions\Func_value_wcvar_ni.m) for function calculation:
%Calculation of functions with PSG Subroutine 'functionvalue'
%Define data:
H1 = [-1 -31 14 21 5 9 -5 1];
H2 = [1 2 3 4 5 6 7 8];
a = [0.125;0.125;0.125;0.125;0.125;0.125;0.125;0.125];
%Calculate wcvar_ni function with parameter 0.8 at point 'a':
val1 = functionvalue('wcvar_ni', 0.8, {H1 ,H2}, {[] ,[]}, {[] ,[]}, 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', H1, [], [], []);
%Create the PSG matrix 'matrix_2'(structure containing header and matrix body) and pack it to structure 'iargstruc_arr':
iargstruc_arr(2) = matrix_pack('matrix_2', H2, [], [], []);
%Create the PSG point 'point_1'(structure containing header and matrix body) and pack it to structure 'iargstruc_arr':
iargstruc_arr(3) = point_pack('point_1', a, []);
%Calculate wcvar_ni function with parameter 0.8 at point 'point_1':
val2 = mpsg_function_value('wcvar_ni(0.8,matrix_1,matrix_2)','point_1',iargstruc_arr);
%Display function value:
disp(sprintf('mpsg_function_value = %g', val2));
Program output:
functionvalue = 18.8107
mpsg_function_value = 18.8107