Artificial intelligent assistant

Produce piecewise monotonic function with 3 points and their slope with MATLAB I'm trying to reproduce the shape of an airfoil's camber line using the leading edge angle, the trailing edge angle, the chord and the max camber value. I cannot use a spline because it overshoots the "max camber". I cannot use 'pchip', a piecewise cubic Hermitian interpolation because I can't clamp ends. I cannot use 'csape' as well because it is a cubic spline interpolation (and therefore overshoots) I'm playing around to generate a fifth order function, but I fear it is a futile endeavor.

If by "clamp" you mean "set endpoint derivatives", then yes, MATLAB's `pchip()` won't let you do that. You will have to write your own implementation of the Fritsch-Carlson scheme for computing the slopes $y_i^\prime$ corresponding to inner points $(x_i,y_i)$, though:

$$y_i^\prime = \begin{cases}3(h_{i-1}+h_i)\left(\frac{2h_i+h_{i-1}}{d_{i-1}}+\frac{h_i+2h_{i-1}}{d_i}\right)^{-1} &\text{ if }\mathrm{sign}(d_{i-1})=\mathrm{sign}(d_i)\\\ 0&\text{ if }\mathrm{sign}(d_{i-1})\
eq\mathrm{sign}(d_i)\end{cases}$$

where $h_i=x_{i+1}-x_i$ and $d_i=\dfrac{y_{i+1}-y_i}{h_i}$, and then use your own values of $y_1^\prime$ and $y_n^\prime$.

Alternatively, I discuss in this answer other monotonic interpolation schemes based on piecewise cubic Hermite interpolants. If you widen your scope to allow, say, rational functions or transcendental functions, as piecewise components, you have other options. I'll leave to you to do the requisite searches of the literature, though.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy f384b3eae1f484cda84d44c5c2d663b1