# Interpolate Matrix(x,y)

Return interpolated matrix for given inputs

GNC/Controls

## Description

The Interpolate Matrix(x,y) block interpolates a two-dimensional array of matrices.

This two-dimensional case assumes the matrix is defined as a function of two independent variables, x = [ x1 x2 x3... xi xi+1 ... xn] and y = [ y1 y2 y3 ... yj yj+1 ... ym]. For given values of x and y, four matrices are interpolated. Then for xi < x < xi+1 and yj < y < yj+1, the output matrix is given by

`$\begin{array}{l}\left(1-{\lambda }_{y}\right)\left[\left(1-{\lambda }_{x}\right)M\left({x}_{i},{y}_{j}\right)+{\lambda }_{x}M\left({x}_{i+1},{y}_{j}\right)\right]+\\ {\lambda }_{y}\left[\left(1-{\lambda }_{x}\right)M\left({x}_{i},{y}_{j+1}\right)+{\lambda }_{x}M\left({x}_{i+1},{y}_{j+1}\right)\right]\end{array}$`

where the two interpolation fractions are denoted by

`${\lambda }_{x}=\left(x-{x}_{i}\right)/\left({x}_{i+1}-{x}_{i}\right)$`

and

`${\lambda }_{y}=\left(y-{y}_{j}\right)/\left({y}_{j+1}-{y}_{j}\right)$`

In the two-dimensional case, the interpolation is carried out first on x and then y.

The matrix to be interpolated should be four dimensional, the first two dimensions corresponding to the matrix at each value of x and y. For example, if you have four matrices A, B, C, and D defined at `(x = 0.0,y = 1.0)`, `(x = 0.0,y = 3.0)`, `(x = 1.0,y = 1.0)` and `(x = 1.0,y = 3.0)`, then the input matrix is given by

`matrix(:,:,1,1) = A;`

`matrix(:,:,1,2) = B;`

`matrix(:,:,2,1) = C;`

`matrix(:,:,2,2) = D;`

## Dialog Box

Matrix to interpolate

Matrix to be interpolated, with four indices and the third and fourth indices labeling the interpolating values of x and y.

## Inputs and Outputs

InputDimension TypeDescription

First

Contains the first interpolation index i.

Second

Contains the first interpolation fraction λx.

Third

Contains the second interpolation index j.

Fourth

Contains the second interpolation fraction λy.

OutputDimension TypeDescription

First

Contains the interpolated matrix.

## Assumptions and Limitations

This block must be driven from the Simulink® Prelookup block.

## Examples

See the following block reference pages: 2D Controller [A(v),B(v),C(v),D(v)], 2D Observer Form [A(v),B(v),C(v),F(v),H(v)], and 2D Self-Conditioned [A(v),B(v),C(v),D(v)].

Interpolate Matrix(x)

Interpolate Matrix(x,y,z)