Available under Creative Commons-ShareAlike 4.0 International License.
clc
disp('A force F acting on a body at a distance s from a fixed point is given by')
disp('F=3*s+(1/(s^2)) where s is the distance in meters')
disp('Compute the total work done in moving')
disp('From the position where s=1 to that where s=10.')
disp(' ') % Display blank line
s=1:.001:10; % Creating a row vector for distance, s
F=3.*s+(1./(s.^2)); % Computing Force for s
WorkDone=trapz(s,F) % Integrating F*ds over 1 to 10 meters.
The output is:
A force F acting on a body at a distance s from a fixed point is given by
F=3*s+(1/(s^2)) where s is the distance in meters
Compute the total work done in moving
From the position where s=1 to that where s=10.
WorkDone =
149.4000
- 1822 reads




