For example:
For x1=0, x2=10, x3=-5, x4 = 5, n1=5, and n2=3.
The returned matrix is y[5,3]
-2.5 |
0 |
2.5 |
-5 |
1.25 |
5 |
-5 |
2.5 |
5 |
-5 |
3.75 |
5 |
2.5 |
10 |
7.5 |
Notice that the center edge values are consistent with the specified input. The corner vlaues are linear interpolations of the adjacent values.
The exposeState options either hold the edge value (=true) or ignore the edge value (=false) and apply linear interpolation appropriately. This capability was made to assist with initialization of discritized models.
With the same input as above but with exposeState={true,false,true,false} the result is:
0 |
0 |
2.5 |
-1.25 |
1.5625 |
5 |
0 |
2.5 |
5 |
1.25 |
3.4375 |
5 |
2.5 |
5 |
5 |
function linspace_2Dedge extends TRANSFORM.Icons.Function; input Real x1 "Edge value x[1,:]"; input Real x2 "Edge value x[end,:]"; input Real x3 "Edge value x[:,1]"; input Real x4 "Edge value x[:,end]"; input Integer n1 "Number of rows"; input Integer n2 "Number of columns"; input Boolean exposeState[4] = {true, true, true, true} "= true then set edge to value specified else linspace_1D"; output Real y[n1, n2] "2-D matrix"; end linspace_2Dedge;