The static Euler-Bernoulli beam is a simplified model from linear elasticity theory for small deformations, with which the stresses and deflections of slender beams can be determined very well. The simplicity of Euler-Bernoulli beam theory makes it still an important tool in the sciences, particularly in construction and mechanical engineering. The behavior and the deflection of a static Euler-Bernoulli beam is completely given by the bending stiffness curve. The bending stiffness curve of a real beam structure can be determined using measured data from a bending test. However, the determination of the bending stiffness curve for non-uniform beams leads to a so-called inverse problem, which is ill-posed. In this work, a robust and computationally effective method for determining the bending stiffness curve of a non-uniform Euler-Bernoulli beam based on measured data from a static bending test and the calculus of variations is presented. With the calculus of variations, the complex optimization problem of the inverse problem is transformed into a boundary value problem, which is then solved by collocation with lower computational costs. In addition, the new method does not require the second derivative of the beam deflection and the problem of determining the bending stiffness at the boundaries does not arise, as with the traditional method. The new method to determine the bending stiffness curve of non-uniform beams is demonstrated in several test examples.