# Using External Function Feature

**URL:** <https://forum.cadet-web.de/t/using-external-function-feature/136>\
**Category:** CADET Troubleshooting\
**Tags:** modeling\
**Created:** [July 16, 2020, 5:47am UTC](https://forum.cadet-web.de/t/using-external-function-feature/136 "2020-07-16T05:47:49Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![s.leweke](https://forum.cadet-web.de/user_avatar/forum.cadet-web.de/s.leweke/32/1323_2.png) [@s.leweke](https://forum.cadet-web.de/u/s.leweke)\
**Post date:** [July 20, 2020, 9:55pm UTC](https://forum.cadet-web.de/t/using-external-function-feature/136/4 "2020-07-20T21:55:01Z")

</div>

There’s nothing built-in, as far as I know.

For the external functions, you can adapt this script:

```python
import numpy as np
import scipy.interpolate as scip
import matplotlib.pyplot as plt

section_times = [0.0, 2.0, 5.0, 10.0]
const_coeff = [0.0, 1.0, 2.0]
lin_coeff = [0.5, -0.1, 0.2]
quad_coeff = [0.0, 0.0, 0.0]
cube_coeff = [0.0, 0.0, 0.0]
velocity = 0.1 
col_length = 0.12

# Evaluation point in column (axial coordinate between 0 and col_length)
z = 0.1

# Convert to piecewise polynomial in scipy format
c = np.array([cube_coeff, quad_coeff, lin_coeff, const_coeff])
p = scip.PPoly(c, section_times)

# Evaluate at point z
t = np.linspace(min(section_times), max(section_times), 1001)
extFun = p((1.0 - z / col_length) / velocity + t)

plt.plot(t, extFun)
plt.xlabel('Time [s]')
plt.ylabel('External Function at z = {}'.format(z))
plt.grid(True)
plt.show()

```

---

_[View the full topic](https://forum.cadet-web.de/t/using-external-function-feature/136)._
