Page 832 - Mechatronics with Experiments
P. 832
818 MECHATRONICS
®
FIGURE A.3: Output plot of the MATLAB M-function file example.
®
main program or in the Command Window of MATLAB ) and in the function that
uses it.
% Main script file name: filename.m
%
global gravity
gravity = 9.81 ;
....
————————————————————————————————————–
% File name: myFunction1.m
function z = myFunction1(time)
global gravity
...
return
Built-in Functions in MATLAB ® Environment MATLAB ® provides a rich
library of built-in functions to provide convenience to the programmer for data manipula-
tion. It is the simplicity of data handling with this rich set of built-in functions and the sim-
®
plicity of I/O handling that makes MATLAB an attractive computational engineering tool.
The following built-in functions are useful in data generation
>> A = zeros(5,5) ;
% all elements of A matrix, 5x5, are zero