# How to find active region in treepartition Matlab object

I am trying to identify a non-linear plant using the identification toolbox of Matlab.

In particular I would like to identify a non-linear arx model, where the nonlinearities are expressed by means of tree partitions.

According to Mathworks (http://it.mathworks.com/help/ident/ref/treepartition.html):

TREEPARTITION is a nonlinear function y = F(x), where y is scalar and x a 1-by-m vector. F is a piecewise linear (affine) function of x:
F(x) = x*L+ [1,x]*C_a + d when x belongs to D_a, where
L is a 1-by-m vector, C_k is a 1-by-(m+1) vector,
and D_k is partition of the x-space. The active partition D_a is determined as an intersection of half-spaces by a binary tree as follows: first a tree with N nodes and J levels is initialized. A node at level J is a terminating leaf and a node at a level j < J has two descendants at level j+1. All levels are complete, so N = 2^(J+1)-1. The partition at node r is based on [1,x]*B_r > 0 or <= 0 (move to left or right descendant), where B_r is chosen to improve the stability of least-square computation on the partitions at the descendant nodes. Then at each node r the coefficients C_r of best linear approximation of unknown regression function on D_r are computed using penalized least-squares algorithm.

[...]

When the value of the mapping F, defined by the treepartition object, is computed at x, an adaptive algorithm selects the active node k of the tree on the branch of partitions which contain x.

In this description it is not clear what is the underlying algorithm used to identify the current active node. Indeed, at a first glance, I tought that all the intermediate nodes were decisional nodes and the terminating leafs were containing the unknown coefficients that have to be used for a particular PWA representation.

That approach is not correct, indeed as bolded in the citation, every single node has its own set or parameters that best fit the unknown regression function in D_r.