this is a meta-function

Morphs the metrics of tree intree without changing angles or topology (see introduction section “morphing a tree”). Attributes length values from Nx1 vector v to the individual segments but keeps the branching structure otherwise intact. This can result in overlap between previously non-overlapping segments or extreme sparseness depending on intree and v. This function provides universal application to all possible morpho-electrotonic transforms and much more. If the original lengths of segments are backed up in a vector len, the original tree can simply be recovered by:

originaltree = morph_tree (morphedtree, len);

However of course, 0-length segments cannot be regrown.

Example:
map new (random) lengths on the topology, conserving the angles

>> morph_tree (sample2_tree, randn(15, 1)*5 + 10)

TREES

see demo movie with option '-m'

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License