90 CIRCUIT ANALYSIS TECHNIQUES
the author of this text has developed “Electrical Machines Toolbox” for the analysis and design
of electrical machines.
The MATLAB environment consists of a command window, a figure window, and a platform-
dependent edit window, as illustrated in Figure 2.6.2. The command window, which is the main
window, is characterized by the MATLAB command prompt>>. All commands, including
those for running user-written programs, are typed in this window at the MATLAB prompt. The
graphics window or the figure window receives the output of all graphics commands typed in the
command window. The user can create as many figure windows as the system memory would
allow. The edit window is where one writes, edits, creates, and saves one’s own programs in files
called M-files. Most programs that are written in MATLAB are saved as M-files, and all built-in
functions in MATLAB are M-files.
Let us now take an illustrative example in circuits to solve a set of simultaneous equations
with the use of MATLAB.
Circle of radius R = 1
% This is the command prompt
% Here is a simple command
>> area = pix5^2 % Assign to a variable
2 + 2
-1 -0.5 0.5 1
% This is a script file to plot a circle.
% you may specify a 'radius.'
% To execute, just type 'circle'
if exist ('radius')
R = radius;
R = 1;
Figure 2.6.2Illustration of a command window, a figure window, and a platform-dependent edit window
in the MATLAB environment.