Professional Documents
Culture Documents
Exercise 4.1
Exercise 4.1
1. If a force F(N) is applied to compress a spring, its displacement x(cm) can often be
modelled by Hookes law: where k = the spring constant (N/m). The potential
energy stored in the spring U (J) can then be computed as
Test 1 2 3 4 5
F (N) 14 18 8 9 13
a) Create a m-file to determine the spring constant in each test, the potential energy, and
the average value of potential energy.
b) Create a function file with input data of x and F and return the average value of
potential energy as output
c) Using the same function file in (2), return the potential energy and average value of
potential energy as output.
2. The density of freshwater can be computed as a function of temperature with the following
cubic equation: