您在這裡

Example 6.5

12 十月, 2015 - 11:23

A body moves from rest under the action of a direct force given by F=\frac{15}{x+3} where x is the distance in meters from the starting point. Write a script to compute the total work done in moving a distance 10 m. 1

Recall that the general definition of mechanical work is given by the following integral, see Wikipedia2:

WD=\int Fdx

Therefore we can write:

WD=\int_{0}^{10}\frac{15}{x+3}dx

Applying the steps we followed in the previous examples, we write:

    clc
disp('A body moves from rest under the action of a direct force given')
disp('by F=15/(x+3) where x is the distance in meters')
disp('From the starting point.')
disp('Compute the total work done in moving a distance 10 m.')
disp(' ')                       % Display blank line
x=0:.001:10;       % Creating a row vector for distance, x
F=15./(x+3);      % Computing Force for x
WorkDone=trapz(x,F) % Integrating F*dx over 0 to 10 meters.

The output of the above code is:

    A body moves from rest under the action of a direct force given
by F=15/(x+3) where x is the distance in meters
From the starting point.
Compute the total work done in moving a distance 10 m.
WorkDone =
    21.9951