
Available under Creative Commons-ShareAlike 4.0 International License.
The m-file content:
The html output:
%% Work done % This script computes the work done on an object 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 %% Create a row vector for distance, s s=1:.001:10; %% Compute Force for s F=3.*s+(1./(s.^2)); % Computing Force for s %% Integrating F*ds over 1 to 10 meters. WorkDone=trapz(s,F)

Figure 8.7 The published html file.
- 瀏覽次數:1244