# Numerically designing a periodic 1D curve that maximizes an integral area objective and satisfies value, derivative, and frequency constraints

I need to write MATLAB program (or use an existing one) to obtain Fourier series coefficients. Let's say the series is going to approximate a 1D curve. The boundary conditions are:

• value of the curve's function in a few places
• curve's first derivative known in a few places
• maximum allowed value of curve's second derivative
• number of harmonics
• the value of curve's integral over a specified interval should be as big as possible <- optimization criterion.

All the functions and tools I've seen so far can obtain series coefficients in much more simple cases. Any hints will be helpful, especially:

• literature, articles with descriptions of useful methods
• hints on objective functions useful for Fourier Series
• info on useful MATLAB Tools
• It seems the same question asked here. – Stefano M Aug 9 '12 at 13:09
• @Jann - You might have better luck on here explaining how you are formulating your optimization problem and asking for specific advice on each bit. I don't know of a general-purpose MATLAB tool that will solve this problem for you. – Aron Ahmadia Aug 10 '12 at 13:35

## 1 Answer

Write your function as a linear combination of harmonics and treat the coefficients as variables. This gives a semi-infinite linear program. The Matlab optimization toolbox has a routine linprog to solve linear programs (LPs) only; so you need to discretize the curvature constraint.

Replace the curvature constraint by $N$ constraints evaluated at $N$ equidistant points, solve the LP, add more points close to the points where near-worst case curvature occurred, and repeat until the desired accuracy is reached.