You are on page 1of 38

Electrical discharge machining

An electrical discharge machine

Electric discharge machining (EDM), sometimes colloquially also referred to as spark
machining, spark eroding, burning, die sinking or wire erosion,[1] is a manufacturing process
whereby a wanted shape of an object, called workpiece, is obtained using electrical discharges
(sparks). The material removal from the workpiece occurs by a series of rapidly recurring current
discharges between two electrodes, separated by a dielectric liquid and subject to an electric
voltage. One of the electrodes is called tool-electrode and is sometimes simply referred to as
‘tool’ or ‘electrode’, whereas the other is called workpiece-electrode, commonly abbreviated in
‘workpiece’. When the distance between the two electrodes is reduced, the intensity of the
electric field in the volume between the electrodes is expected to become larger than the strength
of the dielectric (at least in some point(s)) and therefore the dielectric breaks allowing some
current to flow between the two electrodes. This phenomenon is the same as the breakdown of a
capacitor (condenser) (see also breakdown voltage). A collateral effect of this passage of current
is that material is removed from both the electrodes. Once the current flow stops (or it is stopped
- depending on the type of generator), new liquid dielectric should be conveyed into the inter-
electrode volume enabling the removed electrode material solid particles (debris) to be carried
away and the insulating proprieties of the dielectric to be restored. This addition of new liquid
dielectric in the inter-electrode volume is commonly referred to as flushing. Also, after a current
flow, a difference of potential between the two electrodes is restored as it was before the
breakdown, so that a new liquid dielectric breakdown can occur.

• 1 History
• 2 Generalities
• 3 Definition of the technological parameters
• 4 Material removal mechanism
• 5 Types
o 5.1 Sinker EDM
o 5.2 Wire EDM
• 6 Applications
o 6.1 Prototype production
o 6.2 Coinage die making
o 6.3 Small hole drilling
• 7 Advantages and disadvantages
• 8 See also
• 9 References

• 10 External links

The EDM process was invented by two Russian scientists, Dr. B.R. Lazarenko and Dr. N.I.
Lazarenko in 1943.

The first numerically controlled (NC, or computer controlled) EDM was invented by Makino in
Japan in 1980.

Agie launches in 1969 the world's first series-produced, numerically controlled wire-cut EDM

Electrical discharge machining is a machining method primarily used for hard metals or those
that would be very difficult to machine with traditional techniques. EDM typically works with
materials that are electrically conductive, although methods for machining insulating ceramics
with EDM have also been proposed. EDM can cut intricate contours or cavities in pre-hardened
steel without the need for heat treatment to soften and re-harden them. This method can be used
with any other metal or metal alloy such as titanium, hastelloy, kovar, and inconel.

EDM is often included in the ‘non-traditional’ or ‘non-conventional’ group of machining
methods together with processes such as electrochemical machining (ECM), water jet cutting
(WJ, AWJ), laser cutting and opposite to the ‘conventional’ group (turning, milling, grinding,
drilling and any other process whose material removal mechanism is essentially based on
mechanical forces). Ideally, EDM can be seen as a series of breakdowns and restorations of the
liquid dielectric in-between the electrodes. However, caution should be exerted in considering
such a statement because it is an idealized model of the process, introduced to describe the
fundamental ideas underlying the process. Yet, any practical application involves many aspects
that may also need to be considered. For instance, the removal of the debris from the inter-
electrode volume is likely to be always partial. Thus the electrical proprieties of the dielectric in
the inter-electrodes volume can be different from their nominal values and can even vary with
time. The inter-electrode distance, often also referred to as spark-gap, is the end result of the
control algorithms of the specific machine used. The control of such a distance appears logically
to be central to this process. Also, not all of the current flow between the dielectric is of the ideal
type described above: the spark-gap can be short-circuited by the debris. The control system of
the electrode may fails to react quickly enough to prevent the two electrodes (tool and
workpiece) to get in contact with a consequent short circuit. And this is unwanted because a short
circuit contributes to the removal differently from the ideal case. The flushing action can be
inadequate to restore the insulating properties of the dielectric so that the flow of current happens
always in the point of the inter-electrode volume (this is referred to as arcing), with a consequent
unwanted change of shape (damage) of the tool-electrode and workpiece. Ultimately, A
description of this process in a suitable way for the specific purpose at hand is what makes the
EDM area such a rich field for further investigations and research. To obtain a specific geometry,
the EDM tool is guided along the desired path very close to the work, ideally it should not touch
the workpiece, although in reality this may happens due to the performance of the specific
motion control in use. In this way a large number of current discharges (colloquially also called
sparks) happen, each contributing to the removal of material from both tool and workpiece,
where small craters are formed. The size of the craters is a function of the technological
parameters set for the specific job at hand. They can be with typical dimensions ranging from the
nanoscale (in micro-EDM operations) to some hundreds of micrometers in roughing conditions.
The presence of these small craters on the tool results in the gradual erosion of the electrode.
This erosion of the tool-electrode is also referred to as wear. Strategies are needed to counteract
the detrimental effect of the wear on the geometry of the workpiece. One possibility is that of
continuously replacing the tool-electrode during a machining operation. This is what happens if a
continuously replaced wire is used as electrode. In this case, the correspondent EDM process is
also called wire-EDM. The tool-electrode can also be used in such a way that only a small
portion of it is actually engaged into the machining process and this portion is changed on a
regular basis. This is for instance the case, when using as tool-electrode a rotating disk. The
corresponding process is often also referred to as EDM-grinding. A further strategy consists in
using a set of electrodes with different sizes and shapes during the same EDM operation. This is
often referred to as multiple electrode strategy and is most common when the tool electrode
replicates in negative the wanted shape and is advanced towards the blank along a single
direction, usually the vertical direction (i.e. z- axis). This resembles the sink of the tool into the
dielectric liquid in which the workpiece is immersed, so, not surprisingly, it is often referred to as
die-sinking EDM (also called Conventional EDM and Ram EDM). The correspondent machines
are often called Sinker EDM. Usually, the electrodes of this types have quite complex forms. If
the final geometry is obtained using a usually simple shaped electrode which is moved along
several directions and is possibly also subject to rotations often the term EDM-milling is used. In
any case, the severity of the wear is strictly dependent on the technological parameters used in
the operation (for instance: polarity, maximum current, open circuit voltage). For example, in
micro-EDM, also known as μ-EDM, these parameters are usually set at values which generates
sever wear. Therefore, wear is a major problem in that area.

Definition of the technological parameters
Some difficulties have been encountered in the definition of the technological parameters that
drive the process. The reasons are explained below.

On the one hand, two broad categories of generators, also known as power supplies, are in use on
EDM machines commercially available: the group based on RC circuits and the group based on
transistor controlled pulses. In the first category, the main parameters that a practitioner may be
expected to choose from at set-up time are the resistance(s) of the resistor(s) and the
capacitance(s) of the capacitor(s).

In an ideal condition these quantities would then affect the maximum current delivered in an
ideal discharge, which is expected to be associated with the charge accumulated on the capacitors
at a certain moment in time. Little control, however is expected to be possible on the time
duration of the discharge, which is likely to depend on the actual spark-gap conditions (size and
pollution) at the moment of the discharge. Yet, this kind of generators can allow the user to
obtain short time durations of the discharges relatively easier than with the a pulse controlled
generator. This advantage is however going to be diminished with the progress in the production
of electronic components.[2] Also, the open circuit voltage (i.e. the voltage between the electrodes
when the dielectric is not yet broken) can be identified as steady state voltage of the RC circuit.
In the second group of generators, based on transistor control usually enables the user to deliver
a train of pulses of voltage to the electrodes. Each pulse can be controlled in shape, for instance
quasi-rectangular. In particular, the time between two consecutive pulses and the duration of each
pulse can be set. The amplitude of each pulse constitutes the open circuit voltage. In this
framework, the maximum time duration of a current discharge is equal to the duration of a pulse
of voltage in the train. Two pulses of current are then expected not to occur for a duration equal
or larger than the time interval between two consecutive pulses of voltage. The maximum current
during a discharge that the generator deliver can also be controlled. Design of generators
different from that described above is likely to be commercially available. Thus, the parameters
that a user may actually set on his own machine may be quite different and generator-
manufacturer dependent. Moreover, the manufacturers are usually quite reluctant to unveil the
details of their generators and control systems to their user base not to give a potential
competitive advantage to their competitors. And, conversely, the average users are usually more
interested in a ‘machine that can do the job’, rather than in through understanding of the EDM
process. This circumstance constitutes another barrier to the attempt of describing unequivocally
the technological parameters of the EDM process. Moreover, the parameters affecting the
phenomena occurring between tool and electrode are related not only to the generator design but
also to the controller of the motion of the electrodes. A framework to define and measure the
electrical parameters during an EDM operation directly on inter-electrode volume with an
oscilloscope external to the machine has been recently proposed by Ferri et al.[3] These authors
conducted their research in the filed of μ-EDM, but the same approach can be used in any EDM
operation. This would enable the user to estimate directly the electrical parameter that affect their
operations in an open way, without relying upon machine manufacturer's claims. Finally, it is
worth mentioning that, quite unexpectedly, when machining different materials in identical
nominal set-up conditions the actual electrical parameters of the process are significantly

Material removal mechanism
The first serious attempt of providing a physical explanation of the material removal during
electric discharge machining is perhaps that of Van Dijk [4]. In his work, Van Dijk present a
thermal model together with a computational simulation to explain the phenomena between the
electrodes during electric discharge machining. However, as Van Dijk himself admitted in his
study, the number of assumptions made to overcome the unavailability of experimental data at
that time was quite significant.

Further enhanced models trying to explain the phenomena occurring during electric discharge
machining in terms of heat transfer theories were developed in the late eighties and early
nineties. Possibly the most advanced explanation of the EDM process as a thermal process was
developed during an investigation carried out at TeXas A&M University with the support of
AGIE, now Agiecharmilles, a company with headquarters in Switzerland. This stream of
research resulted in a series of three scholarly papers: the first presenting a thermal model
addressing the material removal on the cathode [5] , the second, presenting a thermal model for
the erosion occurring on the anode [6] and the third introducing a model describing the plasma
channel that is formed during the passage of the discharge current through the dielectric liquid [7].
Validation of these models is carried out also using experimental data provided by AGIE. These
models constitute the most authoritative support for the claim that EDM is a thermal process,
describing how the material is removed from the two electrodes because of melting and/or
vaporization processes in conjunction with pressure dynamics established in the spark-gap by the
collapsing of the plasma channel. However, from a careful reading of these papers it emerges
that for small discharge energies the presented models are quite inadequate to explain the
experimental data. Also, all these models hinge on a number of assumptions, often taken from
such disparate research areas as submarine explosions, discharges in gases, and failure of
transformers. So it is not surprising that alternative models have been proposed more recently in
the literature trying to explain the EDM process. Among these, the model from Sigh and Ghosh
re-connects the removal of material from the electrode to the presence of an electrical force on
the surface of the electrode that would be able to mechanically remove material and create the
craters. This would be made possible by the fact that the material on the surface has reduced
mechanical proprieties due to an increased temperature caused by the passage of electrical
current. The authors simulated their models and showed how they might explain EDM better
than a thermal model (melting and/or evaporation), especially for small discharge energies,
which are typically used in μ-EDM and in finishing operations. In the light of the many available
models, it appears that the material removal mechanism in EDM is not yet well understood and
that further investigation is necessary to clarify it.[3] Especially considering the lack of
experimental scientific evidence to build and validate the current EDM models.[3]
Sinker EDM

Sinker EDM sometimes is also referred to as cavity type EDM or volume EDM. Sinker EDM
consists of an electrode and workpiece that are submerged in an insulating liquid such as oil or
dielectric fluid. The electrode and workpiece are connected to a suitable power supply. The
power supply generates an electrical potential between the two parts. As the electrode approaches
the workpiece, dielectric breakdown occurs in the fluid forming an ionization channel, and a
small spark jumps. The resulting heat and cavitation vaporize the base material, and to some
extent, the electrode. These sparks strike one at a time in huge numbers at seemingly random
locations between the electrode and the workpiece. As the base metal is eroded, and the spark
gap subsequently increased, the electrode is lowered automatically by the machine so that the
process can continue uninterrupted. Several hundred thousand sparks occur per second in this
process, with the actual duty cycle being carefully controlled by the setup parameters. These
controlling cycles are sometimes known as "on time" and "off time". The on time setting
determines the length or duration of the spark. Hence, a longer on time produces a deeper cavity
for that spark and all subsequent sparks for that cycle creating a rougher finish on the workpiece.
The reverse is true for a shorter on time. Off time is the period of time that one spark is replaced
by another. A longer off time for example, allows the flushing of dielectric fluid through a nozzle
to clean out the eroded debris, thereby avoiding a short circuit. These settings are maintained in
micro seconds. The typical part geometry is to cut small or odd shaped angles. Vertical, orbital,
vectorial, directional, helical, conical, rotational, spin and indexing machining cycles are also

Wire EDM

In wire electrical discharge machining (WEDM), or wire-cut EDM, a thin single-strand metal
wire, usually brass, is fed through the workpiece, typically occurring submerged in a tank of
dielectric fluid. This process is used to cut plates as thick as 300mm and to make punches,
tools,and dies from hard metals that are too difficult to machine with other methods. The wire,
which is constantly fed from a spool, is held between upper and lower diamond guides. The
guides move in the x–y plane, usually being CNC controlled and on almost all modern machines
the upper guide can also move independently in the z–u–v axis, giving rise to the ability to cut
tapered and transitioning shapes (circle on the bottom square at the top for example) and can
control axis movements in x–y–u–v–i–j–k–l–. This gives the wire-cut EDM the ability to be
programmed to cut very intricate and delicate shapes. The wire is controlled by upper and lower
diamond guides that are usually accurate to 0.004 mm, and can have a cutting path or kerf as
small as 0.12 mm using Ø 0.1 mm wire, though the average cutting kerf that achieves the best
economic cost and machining time is 0.335 mm using Ø 0.25 brass wire. The reason that the
cutting width is greater than the width of the wire is because sparking also occurs from the sides
of the wire to the work piece, causing erosion. This "overcut" is necessary, predictable, and
easily compensated for. Spools of wire are typically very long. For example, an 8 kg spool of
0.25 mm wire is just over 19 kilometers long. Today, the smallest wire diameter is 20
micrometres and the geometry precision is not far from +/- 1 micrometre. The wire-cut process
uses water as its dielectric with the water's resistivity and other electrical properties carefully
controlled by filters and de-ionizer units. The water also serves the very critical purpose of
flushing the cut debris away from the cutting zone. Flushing is an important determining factor
in the maximum feed rate available in a given material thickness, and poor flushing situations
necessitate the reduction of the feed rate.

Along with tighter tolerances multiaxis EDM wire-cutting machining center have many added
features such as: Multiheads for cutting two parts at the same time, controls for preventing wire
breakage, automatic self-threading features in case of wire breakage, and programmable
machining strategies to optimize the operation.

Wire-cutting EDM is commonly used when low residual stresses are desired. Wire EDM may
leave residual stress on the workpiece that are less significant than those that may be left if the
same workpiece were obtained by machining. In fact in wire EDM there are not large cutting
forces involved in the removal of material. Yet, the workpiece may undergo to a significant
thermal cycle, whose severity depends on the technological parameters used. Possible effects of
such thermal cycles are the formation of a recast layer on the part and the presence of tensile
residual stresses on the workpiece. If the process is set up so that the energy/power per pulse is
relatively little (typically in finishing operations), little change in the mechanical properties of a
material is expected in wire-cutting EDM due to these low residual stresses, although material
that hasn't been stressed relieved can distort in the machining process.

Prototype production

The EDM process is most widely used by the mould-making tool and die industries, but is
becoming a common method of making prototype and production parts, especially in the
aerospace, automobile and electronics industries in which production quantities are relatively
low. In Sinker EDM, a graphite, copper tungsten or pure copper electrode is machined into the
desired (negative) shape and fed into the workpiece on the end of a vertical ram.

Coinage die making

For the creation of dies for producing jewelry and badges by the coinage (stamping) process, the
positive master may be made from sterling silver, since (with appropriate machine settings) the
master is not significantly eroded and is used only once. The resultant negative die is then
hardened and used in a drop hammer to produce stamped flats from cutout sheet blanks of
bronze, silver, or low proof gold alloy. For badges these flats may be further shaped to a curved
surface by another die. This type of EDM is usually performed submerged in an oil-based
dielectric. The finished object may be further refined by hard (glass) or soft (paint) enameling
and/or electroplated with pure gold or nickel. Softer materials such as silver may be hand
engraved as a refinement.
EDM control panel (Hansvedt machine). Machine may be adjusted for a refined surface
(electropolish) at end of process.

Master at top, badge die workpiece at bottom, oil jets at left (oil has been drained). Initial flat
stamping will be "dapped" to give a curved surface.

Small hole drilling

Small hole drilling EDM is used to make a through hole in a workpiece in through which to
thread the wire in Wire-cut EDM machining. The small hole drilling head is mounted on wire-cut
machine and allows large hardened plates to have finished parts eroded from them as needed and
without pre-drilling. There are also stand-alone small hole drilling EDM machines with an x–y
axis also known as a super drill or hole popper that can machine blind or through holes. EDM
Drills bore holes with a long brass or copper tube electrode that rotates in a chuck with a constant
flow of distilled or deionized water flowing through the electrode as a flushing agent and
dielectric. The electrode tubes operate like the wire in wire-cut EDM machines, having a spark
gap and wear rate. Some small-hole drilling EDMs are able to drill through 100 mm of soft or
through hardened steel in less than 10 seconds, averaging 50% to 80% wear rate. Holes of
0.3 mm to 6.1 mm can be achieved in this drilling operation. Brass electrodes are easier to
machine but are not recommended for wire-cut operations due to eroded brass particles causing
"brass on brass" wire breakage, therefore copper is recommended.

Advantages and disadvantages
Some of the advantages of EDM include machining of:

• complex shapes that would otherwise be difficult to produce with conventional cutting
• extremely hard material to very close tolerances
• very small work pieces where conventional cutting tools may damage the part from
excess cutting tool pressure.

Some of the disadvantages of EDM include:

• The slow rate of material removal.
• The additional time and cost used for creating electrodes for ram / Sinker EDM.
• Reproducing sharp corners on the workpiece is difficult due to electrode wear.

A dielectric is a nonconducting substance, i.e. an insulator. The term was coined by William
Whewell in response to a request from Michael Faraday.[1] Although "dielectric" and "insulator"
are generally considered synonymous, the term "dielectric" is more often used to describe
materials where the dielectric polarization is important, such as the insulating material between
the metallic plates of a capacitor, while "insulator" is more often used when the material is being
used to prevent a current flow across it.

Dielectrics is the study of dielectric materials and involves physical models to describe how an
electric field behaves inside a material. It is characterized by how an electric field interacts with
an atom and is therefore possible to approach from either a classical interpretation or a quantum

Many phenomena in electronics, solid state and optical physics can be described using the
underlying assumptions of the dielectric model. This can mean that the same mathematical
objects can go by many different names.

• 1 Definitions
o 1.1 Classical
o 1.2 Behavior
• 2 Dielectric model applied to vacuum
• 3 Applications
o 3.1 Capacitors
o 3.2 Cable insulation
• 4 Some practical dielectrics
• 5 See also
• 6 References

• 7 External links


Electric field interaction with an atom under the classical dielectric model.

Von Hippel, in his seminal work, Dielectric Materials and Applications, stated:

Dielectrics... are not a narrow class of so-called insulators, but the broad expanse of nonmetals
considered from the standpoint of their interaction with electric, magnetic, or electromagnetic
fields. Thus we are concerned with gases as well as with liquids and solids, and with the storage
of electric and magnetic energy as well as its dissipation.[2]

In the classical approach to the dielectric model, a material is made up of atoms. Each atom
consists of a cloud of negative charge bound to and surrounding a positive point charge at its
centre. Because of the comparatively huge distance between them, none of the atoms in the
dielectric material interact with one another[citation needed]. Note: Remember that the model is not
attempting to say anything about the structure of matter. It is only trying to describe the
interaction between an electric field and matter.

In the presence of an electric field the charge cloud is distorted, as shown in the top right of the

This can be reduced to a simple dipole using the superposition principle. A dipole is
characterized by its dipole moment, a vector quantity shown in the figure as the blue arrow
labeled M. It is the relationship between the electric field and the dipole moment that gives rise
to the behavior of the dielectric. Note: The dipole moment is shown to be pointing in the same
direction as the electric field. This isn't always correct, and it is a major simplification, but it is
suitable for many materials.[citation needed]

When the electric field is removed the atom returns to its original state. The time required to do
so is the so-called relaxation time; an exponential decay.


This is the essence of the model in physics. The behavior of the dielectric now depends on the
situation. The more complicated the situation the richer the model has to be in order to accurately
describe the behavior. Important questions are:

• Is the electric field constant or does it vary with time?
o If the electric field does vary, at what rate?
• What are the characteristics of the material?
o Is the direction of the field important (isotropy)?
o Is the material the same all the way through (homogeneous)?
o Are there any boundaries/interfaces that have to be taken into account?
• Is the system linear or do nonlinearities have to be taken into account?

The relationship between the electric field E and the dipole moment M gives rise to the behavior
of the dielectric, which, for a given material, can be characterized by the function F defined by
the equation:


When both the type of electric field and the type of material have been defined, one then chooses
the simplest function F that correctly predicts the phenomena of interest. Examples of possible
• Refractive index
• Group velocity dispersion
• Birefringence
• Self-focusing
• Harmonic generation

May be modeled by choosing a suitable function F.

Dielectric model applied to vacuum
From the definition it might seem strange to apply the dielectric model to a vacuum, however, it
is both the simplest and the most accurate example of a dielectric.

Recall that the property which defines how a dielectric behaves is the relationship between the
applied electric field and the induced dipole moment. For a vacuum the relationship is a real
constant number. This constant is called the permittivity of free space, ε0.


Commercially manufactured capacitors typically use a solid dielectric material with high
permittivity as the intervening medium between the stored positive and negative charges. This
material is often referred to in technical contexts as the "capacitor dielectric" [3] . The most
obvious advantage to using such a dielectric material is that it prevents the conducting plates on
which the charges are stored from coming into direct electrical contact. More significantly
however, a high permittivity allows a greater charge to be stored at a given voltage. This can be
seen by treating the case of a linear dielectric with permittivity ε and thickness d between two
conducting plates with uniform charge density σε. In this case, the charge density is given by

and the capacitance per unit area by

From this, it can easily be seen that a larger ε leads to greater charge stored and thus greater

Dielectric materials used for capacitors are also chosen such that they are resistant to ionization.
This allows the capacitor to operate at higher voltages before the insulating dielectric ionizes and
begins to allow undesirable current flow.
Cable insulation

The term "dielectric" may also refer to the insulation used in power and RF cables[citation needed].
Common materials used as electrical insulations are electrical insulation paper and plastics.

Some practical dielectrics
Dielectric materials can be solids, liquids, or gases. In addition, a high vacuum can also be a
useful, lossless dielectric even though its relative dielectric constant is only unity.

Solid dielectrics are perhaps the most commonly used dielectrics in electrical engineering, and
many solids are very good insulators. Some examples include porcelain, glass, and most plastics.
Air, nitrogen and sulfur hexafluoride are the three most commonly used gaseous dielectrics.

• Industrial coatings such as parylene provide a dielectric barrier between the substrate and
its environment.
• Mineral oil is used extensively inside electrical transformers as a fluid dielectric and to
assist in cooling. Dielectric fluids with higher dielectric constants, such as electrical grade
castor oil, are often used in high voltage capacitors to help prevent corona discharge and
increase capacitance.
• Because dielectrics resist the flow of electricity, the surface of a dielectric may retain
stranded excess electrical charges. This may occur accidentally when the dielectric is
rubbed (the triboelectric effect). This can be useful, as in a Van de Graaff generator or
electrophorus, or it can be potentially destructive as in the case of electrostatic discharge.
• Specially processed dielectrics, called electrets (also known as ferroelectrics), may retain
excess internal charge or "frozen in" polarization. Electrets have a semipermanent
external electric field, and are the electrostatic equivalent to magnets. Electrets have
numerous practical applications in the home and industry.
• Some dielectrics can generate a potential difference when subjected to mechanical stress,
or change physical shape if an external voltage is applied across the material. This
property is called piezoelectricity. Piezoelectric materials are another class of very useful
• Some ionic crystals and polymer dielectrics exhibit a spontaneous dipole moment which
can be reversed by an externally applied electric field. This behavior is called the
ferroelectric effect. These materials are analogous to the way ferromagnetic materials
behave within an externally applied magnetic field. Ferroelectric materials often have
very high dielectric constants, making them quite useful for capacitors.
Milling machine

Example of a CNC vertical milling center

A CAD designed part (top) and physical part (bottom) produced by CNC milling.
This article includes a list of references, related reading or external links, but its sources
remain unclear because it lacks inline citations. Please improve this article by
introducing more precise citations where appropriate. (October 2008)

A milling machine is a machine tool used for the shaping of metal and other solid materials.
Milling machines exist in two basic forms: horizontal and vertical, which terms refer to the
orientation of the cutting tool spindle. Unlike a drill press, in which the workpiece is held
stationary and the drill is moved vertically to penetrate the material, milling also involves
movement of the workpiece against the rotating cutter, the latter which is able to cut on its flanks
as well as its tip. Workpiece and cutter movement are precisely controlled to less than 0.001
inches (.025 millimeters), usually by means of precision ground slides and leadscrews or
analogous technology. Milling machines may be manually operated, mechanically automated, or
digitally automated via computer numerical control (CNC).

Milling machines can perform a vast number of operations, some very complex, such as slot and
keyway cutting, planing, drilling, diesinking, rebating, routing, etc. Cutting fluid is often pumped
to the cutting site to cool and lubricate the cut, and to sluice away the resulting swarf.


• 1 Types
o 1.1 Comparing vertical with horizontal
o 1.2 Other milling machine variants and terminology
• 2 Computer numerical control
o 2.1 Milling machine tooling
• 3 History
o 3.1 1810s-1830s
o 3.2 1840s-1860
o 3.3 1860s
o 3.4 1870s-1930s
o 3.5 1940s-1970s
o 3.6 1980s-present
• 4 See also
• 5 References
• 6 Further reading

• 7 External links

There are many ways to classify milling machines, depending on which criteria are the focus:

Criterion Example classification scheme Comments
In the CNC era, a very basic distinction is manual versus
Control Mechanically automated via cams;
Among manual machines, a worthwhile distinction is non-
Digitally automated via NC/CNC
DRO-equipped versus DRO-equipped
Number of axes (e.g., 3-axis, 4-axis,
or more);
Within this scheme, also:

Control (specifically • Pallet-changing versus non-
among CNC machines) pallet-changing

• Full-auto tool-changing
versus semi-auto or manual
Vertical versus horizontal; Among vertical mills, "Bridgeport-style" is a whole class of
Spindle axis orientation
Turret versus non-turret mills inspired by the Bridgeport original
General-purpose versus special-
purpose or single-purpose
Toolroom machine versus production
Purpose Overlaps with above
Purpose "Plain" versus "universal" A distinction whose meaning evolved over decades as
technology progressed, and overlaps with other purpose
classifications above; more historical interest than current
Micro, mini, benchtop, standing on
floor, large, very large, gigantic
Line-shaft-drive versus individual Most line-shaft-drive machines, ubiquitous circa 1880-1930,
electric motor drive have been scrapped by now
Power source
Hand-cranked not used in industry but suitable for hobbyist
Hand-crank-power versus electric

Comparing vertical with horizontal

In the vertical mill the spindle axis is vertically oriented. Milling cutters are held in the spindle
and rotate on its axis. The spindle can generally be extended (or the table can be raised/lowered,
giving the same effect), allowing plunge cuts and drilling. There are two subcategories of vertical
mills: the bedmill and the turret mill. Turret mills, like the ubiquitous Bridgeport, are generally
smaller than bedmills, and are considered by some to be more versatile. In a turret mill the
spindle remains stationary during cutting operations and the table is moved both perpendicular to
and parallel to the spindle axis to accomplish cutting. In the bedmill, however, the table moves
only perpendicular to the spindle's axis, while the spindle itself moves parallel to its own axis.
Also of note is a lighter machine, called a mill-drill. It is quite popular with hobbyists, due to its
small size and lower price. These are frequently of lower quality than other types of machines,

A horizontal mill has the same sort of x–y table, but the cutters are mounted on a horizontal arbor
(see Arbor milling) across the table. A majority of horizontal mills also feature a +15/-15 degree
rotary table that allows milling at shallow angles. While endmills and the other types of tools
available to a vertical mill may be used in a horizontal mill, their real advantage lies in arbor-
mounted cutters, called side and face mills, which have a cross section rather like a circular saw,
but are generally wider and smaller in diameter. Because the cutters have good support from the
arbor, quite heavy cuts can be taken, enabling rapid material removal rates. These are used to
mill grooves and slots. Plain mills are used to shape flat surfaces. Several cutters may be ganged
together on the arbor to mill a complex shape of slots and planes. Special cutters can also cut
grooves, bevels, radii, or indeed any section desired. These specialty cutters tend to be expensive.
Simplex mills have one spindle, and duplex mills have two. It is also easier to cut gears on a
horizontal mill.
A miniature hobbyist mill plainly showing the basic parts of a mill.

Other milling machine variants and terminology

• Box or column mills are very basic hobbyist bench-mounted milling machines that feature
a head riding up and down on a column or box way.
• Turret or vertical ram mills are more commonly referred to as Bridgeport-type milling
machines. The spindle can be aligned in many different positions for a very versatile, if
somewhat less rigid machine.
• Knee mill or knee-and-column mill refers to any milling machine whose x-y table rides up
and down the column on a vertically adjustable knee. This includes Bridgeports.
• C-Frame mills are larger, industrial production mills. They feature a knee and fixed
spindle head that is only mobile vertically. They are typically much more powerful than a
turret mill, featuring a separate hydraulic motor for integral hydraulic power feeds in all
directions, and a twenty to fifty horsepower motor. Backlash eliminators are almost
always standard equipment. They use large NMTB 40 or 50 tooling. The tables on C-
frame mills are usually 18" by 68" or larger, to allow multiple parts to be machined at the
same time.
• Planer-style mills are large mills built in the same configuration as planers except with a
milling spindle instead of a planing head. This term is growing dated as planers
themselves are largely a thing of the past.
• Bed mill refers to any milling machine where the spindle is on a pendant that moves up
and down to move the cutter into the work. These are generally more rigid than a knee
• Ram type mill refers to a mill that has a swiveling cutting head mounted on a sliding ram.
The spindle can be oriented either vertically or horizontally, or anywhere in between. Van
Norman specialized in ram type mills through most of the 20th century, but since the
advent of CNC machines ram type mills are no longer made.
• Jig borers are vertical mills that are built to bore holes, and very light slot or face milling.
They are typically bed mills with a long spindle throw. The beds are more accurate, and
the handwheels are graduated down to .0001" for precise hole placement.
• Horizontal boring mills are large, accurate bed horizontal mills that incorporate many
features from various machine tools. They are predominantly used to create large
manufacturing jigs, or to modify large, high precision parts. They have a spindle stroke of
several (usually between four and six) feet, and many are equipped with a tailstock to
perform very long boring operations without losing accuracy as the bore increases in
depth. A typical bed would have X and Y travel, and be between three and four feet
square with a rotary table or a larger rectangle without said table. The pendant usually has
between four and eight feet in vertical movement. Some mills have a large (30" or more)
integral facing head. Right angle rotary tables and vertical milling attachments are
available to further increase productivity.
• Floor mills have a row of rotary tables, and a horizontal pendant spindle mounted on a set
of tracks that runs parallel to the table row. These mills have predominantly been
converted to CNC, but some can still be found (if one can even find a used machine
available) under manual control. The spindle carriage moves to each individual table,
performs the machining operations, and moves to the next table while the previous table
is being set up for the next operation. Unlike any other kind of mill, floor mills have floor
units that are entirely movable. A crane will drop massive rotary tables, X-Y tables, and
the like into position for machining, allowing the largest and most complex custom
milling operations to take place.

Computer numerical control

Thin wall milling of aluminum using a water based coolant on the milling cutter

Most CNC milling machines (also called machining centers) are computer controlled vertical
mills with the ability to move the spindle vertically along the Z-axis. This extra degree of
freedom permits their use in diesinking, engraving applications, and 2.5D surfaces such as relief
sculptures. When combined with the use of conical tools or a ball nose cutter, it also significantly
improves milling precision without impacting speed, providing a cost-efficient alternative to
most flat-surface hand-engraving work.
Five-axis machining center with rotating table and computer interface

CNC machines can exist in virtually any of the forms of manual machinery, like horizontal mills.
The most advanced CNC milling-machines, the 5-axis machines, add two more axes in addition
to the three normal axes (XYZ). Horizontal milling machines also have a C or Q axis, allowing
the horizontally mounted workpiece to be rotated, essentially allowing asymmetric and eccentric
turning. The fifth axis (B axis) controls the tilt of the tool itself. When all of these axes are used
in conjunction with each other, extremely complicated geometries, even organic geometries such
as a human head can be made with relative ease with these machines. But the skill to program
such geometries is beyond that of most operators. Therefore, 5-axis milling machines are
practically always programmed with CAM.

With the declining price of computers, free operating systems such as Linux, and open source
CNC software, the entry price of CNC machines has plummeted. For example, Sherline, Prazi,
and others make desktop CNC milling machines that are affordable by hobbyists.

High speed steel with cobalt endmills used for cutting operations in a milling machine.

Milling machine tooling

There is some degree of standardization of the tooling used with CNC Milling Machines and to a
much lesser degree with manual milling machines.

CNC Milling machines will nearly always use SK (or ISO), CAT, BT or HSK tooling. SK tooling
is the most common in Europe, while CAT tooling, sometimes called V-Flange Tooling, is the
oldest variation and is probably still the most common in the USA. CAT tooling was invented by
Caterpillar Inc. of Peoria, Illinois in order to standardize the tooling used on their machinery.
CAT tooling comes in a range of sizes designated as CAT-30, CAT-40, CAT-50, etc. The number
refers to the Association for Manufacturing Technology (formerly the National Machine Tool
Builders Association (NMTB)) Taper size of the tool.
CAT-40 Toolholder

An improvement on CAT Tooling is BT Tooling, which looks very similar and can easily be
confused with CAT tooling. Like CAT Tooling, BT Tooling comes in a range of sizes and uses
the same NMTB body taper. However, BT tooling is symmetrical about the spindle axis, which
CAT tooling is not. This gives BT tooling greater stability and balance at high speeds. One other
subtle difference between these two toolholders is the thread used to hold the pull stud. CAT
Tooling is all Imperial thread and BT Tooling is all Metric thread. Note that this affects the pull
stud only, it does not affect the tool that they can hold, both types of tooling are sold to accept
both Imperial and metric sized tools.

SK and HSK tooling, sometimes called "Hollow Shank Tooling", is much more common in
Europe where it was invented than it is in the United States. It is claimed that HSK tooling is
even better than BT Tooling at high speeds. The holding mechanism for HSK tooling is placed
within the (hollow) body of the tool and, as spindle speed increases, it expands, gripping the tool
more tightly with increasing spindle speed. There is no pull stud with this type of tooling.

The situation is quite different for manual milling machines — there is little standardization.
Newer and larger manual machines usually use NMTB tooling. This tooling is somewhat similar
to CAT tooling but requires a drawbar within the milling machine. Furthermore, there are a
number of variations with NMTB tooling that make interchangeability troublesome.

Boring head on Morse Taper Shank

Two other tool holding systems for manual machines are worthy of note: They are the R8 collet
and the Morse Taper #2 collet. Bridgeport Machines of Bridgeport, Connecticut so dominated the
milling machine market for such a long time that their machine "The Bridgeport" is virtually
synonymous with "Manual milling machine." The bulk of the machines that Bridgeport made
from about 1965 onward used an R8 collet system. Prior to that, the bulk of the machines used a
Morse Taper #2 collet system.
As an historical footnote: Bridgeport is now owned by Hardinge Brothers of Elmira, New York.


Milling machines evolved from the practice of rotary filing—that is, running a circular cutter
with file-like teeth in the headstock of a lathe. Both rotary filing and later true milling were
developed in order to reduce the time and effort spent on hand-filing. The full, true story of the
milling machine's development will probably never be known, because much of the early
development took place in individual shops where generally no one was taking down records for
posterity. However, the broad outlines are known. Rotary filing long predated milling. A rotary
file by Jacques de Vaucanson, circa 1760, is well known. It is clear that milling machines as a
distinct class of machine tool (separate from lathes running rotary files) first appeared between
1814 and 1818. Joseph W. Roe, a respected founding father of machine tool historians, credited
Eli Whitney with producing the first true milling machine. However, subsequent scholars,
including Robert S. Woodbury and others, suggest that just as much credit belongs to various
other inventors, including Robert Johnson, Simeon North, Captain John H. Hall, and Thomas
Blanchard. (Several of the men mentioned above are sometimes described on the internet as "the
inventor of the first milling machine" or "the inventor of interchangeable parts". Such claims are
oversimplified, as these technologies evolved over time among many people.) The two federal
armories of the U.S. (Springfield and Harpers Ferry) and the various private armories and inside
contractors that shared turnover of skilled workmen with them were the centers of earliest
development of true milling machines (as distinct from lathe headstocks tooled up for rotary

James Nasmyth built a milling machine very advanced for its time between 1829 and 1831. It
was tooled to mill the six sides of a hex nut that was mounted in a six-way indexing fixture.

A milling machine built and used in the shop of Gay & Silver (aka Gay, Silver, & Co) in the
1830s was influential because it employed a better method of vertical positioning than earlier
machines. For example, Whitney's machine (the one that Roe considered the very first) and
others did not make provision for vertical travel of the knee. Evidently the workflow assumption
behind this was that the machine would be set up with shims, vise, etc. for a certain part design
and successive parts would not require vertical adjustment (or at most would need only
shimming). This indicates that the earliest way of thinking about milling machines was as
production machines, not toolroom machines.


Some of the key men in milling machine development during this era included Frederick W.
Howe, Francis A. Pratt, Elisha K. Root, and others. (These same men during the same era were
also busy developing the state of the art in turret lathes. Howe's experience at Gay & Silver in the
1840s acquainted him with early versions of both machine tools. His machine tool designs were
later built at Robbins & Lawrence, the Providence Tool Company, and Brown & Sharpe.) The
most successful milling machine design to emerge during this era was the Lincoln miller, which
rather than being a specific make and model of machine tool is truly a family of related tools
built by various companies over several decades. It took its name from the first company to put
one on the market, George S. Lincoln & Company.

During this era there was a continued blind spot in milling machine design, as various designers
failed to develop a truly simple and effective means of providing slide travel in all three of the
archetypal milling axes (X, Y, and Z—or as they were known in the past, longitudinal, traverse,
and vertical). Vertical positioning ideas were either absent or underdeveloped.


Brown & Sharpe's groundbreaking universal milling machine, 1861.

In 1861, Frederick W. Howe, while working for the Providence Tool Company, asked Joseph R.
Brown of Brown & Sharpe for a solution to the problem of milling spirals, such as the flutes of
twist drills. These were filed by hand at the time. Brown designed a "universal milling machine"
that, starting from its first sale in March 1862, was wildly successful. It solved the problem of 3-
axis (XYZ) travel much more elegantly than had been done in the past, and it allowed for the
milling of spirals using an indexing head fed in coordination with the table feed. The term
"universal" was applied to it because it was ready for any kind of work and was not as limited in
application as previous designs. (Howe had designed a "universal miller" in 1852, but Brown's of
1861 is the one considered groundbreakingly successful.)

Brown also developed and patented (1864) the design of formed milling cutters in which
successive sharpenings of the teeth do not disturb the geometry of the form.

The advances of the 1860s opened the floodgates and ushered in modern milling practice.

Two firms which most dominated the milling machine field during these decades were Brown &
Sharpe and the Cincinnati Milling Machine Company. However, hundreds of other firms built
milling machines during this time, and many were significant in one way or another. The
archetypal workhorse milling machine of the late 19th and early 20th centuries was a heavy
knee-and-column horizontal-spindle design with power table feeds, indexing head, and a stout
overarm to support the arbor.

A. L. De Leeuw of the Cincinnati Milling Machine Company is credited with applying scientific
study to the design of milling cutters, leading to modern practice with larger, more widely spaced

Around the end of World War I, machine tool control advanced in various ways that laid the
groundwork for later CNC technology. The jig borer popularized the ideas of coordinate
dimensioning (dimensioning of all locations on the part from a single reference point); working
routinely in "tenths" (ten-thousandths of an inch, 0.0001") as an everyday machine capability;
and using the control to go straight from drawing to part, circumventing jig-making. In 1920 the
new tracer design of J.C. Shaw was applied to Keller tracer milling machines for die-sinking via
the three-dimensional copying of a template. This made diesinking faster and easier just as dies
were in higher demand than ever before, and was very helpful for large steel dies such as those
used to stamp sheets in automobile manufacturing. Such machines translated the tracer
movements to input for servos that worked the machine leadscrews or hydraulics. They also
spurred the development of antibacklash leadscrew nuts. All of the above concepts were new in
the 1920s but would become routine in the NC/CNC era. By the 1930s, incredibly large and
advanced milling machines existed, such as the Cincinnati Hydro-Tel, that presaged today's CNC
mills in every respect except the CNC control itself.


By 1940, automation via cams, such as in screw machines and automatic chuckers, had already
been very well developed for decades. By the close of World War II, many additional ideas
involving servomechanisms were in the air. These ideas, which soon were combined with the
emerging technology of digital computers, transformed machine tool control very deeply. The
details (which are beyond the scope of this article) have evolved immensely with every passing
decade since World War II.

During the 1950s, numerical control (NC) made its appearance.

During the 1960s and 1970s, NC evolved into CNC, data storage and input media evolved,
computer processing power and memory capacity steadily increased, and NC and CNC machine
tools gradually disseminated from the level of huge corporations to the level of medium-sized

Computers and CNC machine tools continue to develop rapidly. The PC revolution has a great
impact on this development. By the late 1980s small machine shops had desktop computers and
CNC machine tools. After that hobbyists began obtaining CNC mills and lathes

This article is about the machine tool programming language. For the video recorder
programming system, see Video recorder scheduling code.

G-Code, or preparatory code or function, are functions in the Numerical control programming
language. The G-codes are the codes that position the tool and do the actual work, as opposed to
M-codes, that manages the machine; T for tool-related codes. S and F are tool-Speed and tool-
Feed, and finally D-codes for tool compensation.

The programming language of Numerical Control (NC) is sometimes informally called G-code.
But in actuality, G-codes are only a part of the NC-programming language that controls NC and
CNC machine tools. The term Numerical Control was coined at the MIT Servomechanisms
Laboratory, and several versions of NC were and are still developed independently by CNC-
machine manufacturers. The main standardized version used in the United States was settled by
the Electronic Industries Alliance in the early 1960s. A final revision was approved in February
1980 as RS274D. In Europe, the standard DIN 66025 / ISO 6983 is often used instead.

Due to the lack of further development, the immense variety of machine tool configurations, and
little demand for interoperability, few machine tool controllers (CNCs) adhere to this standard.
Extensions and variations have been added independently by manufacturers, and operators of a
specific controller must be aware of differences of each manufacturers' product. When initially
introduced, CAM systems were limited in the configurations of tools supported.

Today, the main manufacturers of CNC control systems are GE Fanuc Automation (joint venture
of General Electric and Fanuc), Siemens, Mitsubishi, and Heidenhain, but there still exist many
smaller and/or older controller systems.

Some CNC machine manufacturers attempted to overcome compatibility difficulties by
standardizing on a machine tool controller built by Fanuc. Unfortunately, Fanuc does not remain
consistent with RS-274 or its own previous versions, and has been slow at adding new features,
as well as exploiting increases in computing power. For example, they changed G70/G71 to
G20/G21; they used parentheses for comments which caused difficulty when they introduced
mathematical calculations so they use square parentheses for macro calculations; they now have
nano technology recently in 32-bit mode but in the Fanuc 15MB control they introduced HPCC
(high-precision contour control) which uses a 64-bit RISC processor and this now has a 500
block buffer for look-ahead for correct shape contouring and surfacing of small block programs
and 5-axis continuous machining.
This is also used for NURBS to be able to work closely with industrial designers and the systems
that are used to design flowing surfaces. The NURBS has its origins from the ship building
industry and is described by using a knot and a weight as for bending steamed wooden planks
and beams.

• 1 Common Codes
• 2 Example Program
• 3 See also

• 4 External links

Common Codes
G-codes are also called preparatory codes, and are any word in a CNC program that begins with
the letter 'G'. Generally it is a code telling the machine tool what type of action to perform, such

• rapid move
• controlled feed move in a straight line or arc
• series of controlled feed moves that would result in a hole being bored, a workpiece cut
(routed) to a specific dimension, or a decorative profile shape added to the edge of a
• change a pallet
• set tool information such as offset.

There are other codes; the type codes can be thought of like registers in a computer

X absolute position
Y absolute position
Z absolute position
A position (rotary around X)
B position (rotary around Y)
C position (rotary around Z)
U Relative axis parallel to X
V Relative axis parallel to Y
W Relative axis parallel to Z
M code (another "action" register or Machine code(*)) (otherwise referred to as a
"Miscellaneous" function")
F feed rate
S spindle speed
N line number
R Arc radius or optional word passed to a subprogram/canned cycle
P Dwell time or optional word passed to a subprogram/canned cycle
T Tool selection
I Arc data X axis
J Arc data Y axis.
K Arc data Z axis, or optional word passed to a subprogram/canned cycle
D Cutter diameter/radius offset
H Tool length offset

(*) M codes control the overall machine, causing it to stop, start, turn on coolant, etc., whereas
other codes pertain to the path traversed by cutting tools. Different machine tools may use the
same code to perform different functions; even machines that use the same CNC control.

• Partial list of M-Codes

M00=Program Stop (non-optional)
M01=Optional Stop, machine will only stop if operator selects this option
M02=End of Program
M03=Spindle on (CW rotation)
M04=Spindle on (CCW rotation)
M05=Spindle Stop
M06=Tool Change
M07=Coolant on (flood)
M08=Coolant on (mist)
M09=Coolant off
M10=Pallet clamp on
M11=Pallet clamp off
M30=End of program/rewind tape (may still be required for older CNC machines)

Common FANUC G Codes for Mill
Code Description
G00 Rapid positioning
G01 Linear interpolation
G02 CW circular interpolation
G03 CCW circular interpolation
G04 Dwell
G05.1 Q1. Ai Nano contour control
G05 P10000 HPCC
G07 Imaginary axis designation
G09 Exact stop check
G10/G11 Programmable Data input/Data write cancel
G12 CW Circle Cutting
G13 CCW Circle Cutting
G17 X-Y plane selection
G18 X-Z plane selection
G19 Y-Z plane selection
G20 Programming in inches
G21 Programming in mm
G28 Return to home position
G30 2nd reference point return
G31 Skip function (used for probes and tool length measurement systems)
G33 Constant pitch threading
G34 Variable pitch threading
G40 Tool radius compensation off
G41 Tool radius compensation left
G42 Tool radius compensation right
G43 Tool offset compensation negative
G44 Tool offset compensation positive
G45 Axis offset single increase
G46 Axis offset single decrease
G47 Axis offset double increase
G48 Axis offset double decrease
G49 Tool offset compensation cancel
G50 Define the maximum spindle speed
G53 Machine coordinate system
G54 to G59 Work coordinate systems
G54.1 P1 to
Extended work coordinate systems
G73 High speed drilling canned cycle
G74 Left hand tapping canned cycle
G76 Fine boring canned cycle
G80 Cancel canned cycle
G81 Simple drilling cycle
G82 Drilling cycle with dwell
G83 Peck drilling cycle
G84 Tapping cycle
G84.2 Direct right hand tapping canned cycle
G90 Absolute programming (type B and C systems)
G91 Incremental programming (type B and C systems)
G92 Programming of absolute zero point
Inch per minute/Inch per revolution feed (type A system) Note: Some CNCs use
the SI unit system
G96 Constant surface speed
G97 Constant Spindle speed
G98/G99 Return to Initial Z plane/R plane in canned cycle
A standardized version of G-code known as BCL is used, but only on very few machines.

G-code files may be generated by CAM software. Those applications typically use translators
called post-processors to output code optimized for a particular machine type or family. Post-
processors are often user-editable to enable further customization, if necessary. G-code is also
output by specialized CAD systems used to design printed circuit boards. Such software must be
customized for each type of machine tool that it will be used to program. Some G-code is written
by hand for volume production jobs. In this environment, the inherent inefficiency of CAM-
generated G-code is unacceptable.

Some CNC machines use "conversational" programming, which is a wizard-like programming
mode that either hides G-code or completely bypasses the use of G-code. Some popular
examples are Southwestern Industries' ProtoTRAK, Mazak's Mazatrol, Hurco's Ultimax and
Mori Seiki's CAPS conversational software.

Example Program
This is a generic program that demonstrates the use of G-Code to turn a 1" diameter X 1" long
part. Assume that a bar of material is in the machine and that the bar is slightly oversized in
length and diameter and that the bar protrudes by more than 1" from the face of the chuck.
(Caution: This is generic, it might not work on any real machine! Pay particular attention to point
5 below.)

Tool Path for program
Line Code Description
N01 M216 Turn on load monitor
N02 G00 X20 Z20 Rapid move away from the part, to ensure the starting position of the tool
N03 G50 S2000 Set Maximum spindle speed
N04 M01 Optional stop
Select tool #3 from the carousel, use tool offset values located in line 3 of
N05 T0303 M6
the program table, index the turret to select new tool
G96 S854 M42 Variable speed cutting, 854 ft/min, High spindle gear, Start spindle CW
M03 M08 rotation, Turn the mist coolant on
N07 G00 X1.1 Z1.1 Rapid feed to a point 0.1" from the end of the bar and 0.05" from the side
N08 G01 Z1.0 F.05 Feed in horizontally until the tool is standing 1" from the datum
N09 X0.0 Feed down until the tool is on center - Face the end of the bar
N10 G00 Z1.1 Rapid feed 0.1" away from the end of the bar
N11 X1.0 Rapid feed up until the tool is standing at the finished OD
Feed in horizontally cutting the bar to 1" diameter all the way to the
N12 G01 Z0.0 F.05
N13 M05 M09 Stop the spindle, Turn off the coolant
N14 G28 G91 X0 Home X axis in the machine coordinate system, then home all other axes
N15 M215 Turn the load monitor off
Program stop, pallet change if applicable, rewind to beginning of the
N16 M30

Several points to note:

1. There is room for some programming style, even in this short program. The grouping of
codes in line N06 could have been put on multiple lines. Doing so may have made it
easier to follow program execution.
2. Many codes are "Modal" meaning that they stay in effect until they are cancelled or
replaced by a contradictory code. For example, once variable speed cutting had been
selected (G96), it stayed in effect until the end of the program. In operation, the spindle
speed would increase as the tool neared the center of the work in order to maintain a
constant cutting speed. Similarly, once rapid feed was selected (G00) all tool movements
would be rapid until a feed rate code (G01, G02, G03) was selected.
3. It is common practice to use a load monitor with CNC machinery. The load monitor will
stop the machine if the spindle or feed loads exceed a preset value that is set during the
set-up operation. The job of the load monitor is to prevent machine damage in the event
of tool breakage or a programming mistake. On small or hobby machines, it can warn of
a tool that is becoming dull and needs to be replaced or sharpened.
4. It is common practice to bring the tool in rapidly to a "safe" point that is close to the part
- in this case 0.1" away - and then start feeding the tool. How close that "safe" distance is,
depends on the skill of the programmer and maximum material condition for the raw
5. If the program is wrong, there is a high probability that the machine will crash, or ram
the tool into the part under high power. This can be costly, especially in newer machining
centers. It is possible to intersperse the program with optional stops (M01 code) which
allow the program to be run piecemeal for testing purposes. The optional stops remain in
the program but they are skipped during the normal running of the machine. Thankfully,
most CAD/CAM software ships with CNC simulators that will display the movement of
the tool as the program executes. Many modern CNC machines also allow programmers
to execute the program in a simulation mode and observe the operating parameters of the
machine at a particular execution point. This enables programmers to discover semantic
errors (as opposed to syntax errors) before losing material or tools to an incorrect
program. Depending on the size of the part, wax blocks may be used for testing purposes
as well.
6. For pedagogical purposes, line numbers have been included in the program above. They
are usually not necessary for operation of a machine, so they are seldom used in industry.
However, if branching or looping statements are used in the code, then line numbers may
well be included as the target of those statements (e.g. GOTO N99).

For the subdistrict in Chandpur District, Bangladesh, see Matlab Upazila. For the computer
algebra system, see MATHLAB.

MATLAB R2008a screenshot
Developer(s) The MathWorks
Stable release R2009a / 2009-03-06; 4 months ago
Written in C
Operating system Cross-platform[1]
Type Technical computing
License Proprietary
Website MATLAB product page
Paradigm imperative
Appeared in late 1970s
Designed by Cleve Moler
Developer The MathWorks
Typing discipline dynamic
OS Cross-platform

MATLAB is a numerical computing environment and fourth generation programming language.
Developed by The MathWorks, MATLAB allows matrix manipulation, plotting of functions and
data, implementation of algorithms, creation of user interfaces, and interfacing with programs in
other languages. Although it is numeric only, an optional toolbox uses the MuPAD symbolic
engine, allowing access to computer algebra capabilities. An additional package, Simulink, adds
graphical multidomain simulation and Model-Based Design for dynamic and embedded systems.

In 2004, MathWorks claimed that MATLAB was used by more than one million people across
industry and the academic world.[2]

• 1 History
• 2 Syntax
o 2.1 Variables
o 2.2 Vectors/Matrices
o 2.3 Semicolon
o 2.4 Graphics
• 3 Object-Oriented Programming
• 4 Limitations
• 5 Interactions with other languages
• 6 Alternatives
• 7 Release history
• 8 See also
• 9 References
• 10 Further reading

• 11 External links

MATLAB (meaning "matrix laboratory") was invented in the late 1970s by Cleve Moler, then
chairman of the computer science department at the University of New Mexico.[3] He designed it
to give his students access to LINPACK and EISPACK without having to learn Fortran. It soon
spread to other universities and found a strong audience within the applied mathematics
community. Jack Little, an engineer, was exposed to it during a visit Moler made to Stanford
University in 1983. Recognizing its commercial potential, he joined with Moler and Steve
Bangert. They rewrote MATLAB in C and founded The MathWorks in 1984 to continue its
development. These rewritten libraries were known as JACKPAC.[citation needed] In 2000, MATLAB
was rewritten to use a newer set of libraries for matrix manipulation, LAPACK[4].
MATLAB was first adopted by control design engineers, Little's specialty, but quickly spread to
many other domains. It is now also used in education, in particular the teaching of linear algebra
and numerical analysis, and is popular amongst scientists involved with image processing.[3]

This article is written like a manual or guidebook. Please help rewrite this article from a
neutral point of view. (October 2008)

MATLAB, the application, is built around the MATLAB language. The simplest way to execute
MATLAB code is to type it in at the prompt, >> , in the Command Window, one of the elements
of the MATLAB Desktop. In this way, MATLAB can be used as an interactive mathematical
shell. Sequences of commands can be saved in a text file, typically using the MATLAB Editor, as
a script or encapsulated into a function, extending the commands available.[5]


Variables are defined with the assignment operator, =. MATLAB is dynamically typed, meaning
that variables can be assigned without declaring their type, except if they are to be treated as
symbolic objects[6], and that their type can change. Values can come from constants, from
computation involving values of other variables, or from the output of a function. For example:

>> x = 17
x =
>> x = 'hat'
x =
>> x = [3*4, pi/2]
x =
12.0000 1.5708
>> y = 3*sin(x)
y =
-1.6097 3.0000


MATLAB is a "Matrix Laboratory", and as such it provides many convenient ways for creating
vectors, matrices, and multi-dimensional arrays. In the MATLAB vernacular, a vector refers to a
one dimensional (1×N or N×1) matrix, commonly referred to as an array in other programming
languages. A matrix generally refers to a 2-dimensional array, i.e. an m×n array where m and n
are greater than or equal to 1. Arrays with more than two dimensions are referred to as
multidimensional arrays.

MATLAB provides a simple way to define simple arrays using the syntax:
init:increment:terminator. For instance:

>> array = 1:2:9
array =
1 3 5 7 9

defines a variable named array (or assigns a new value to an existing variable with the name
array) which is an array consisting of the values 1, 3, 5, 7, and 9. That is, the array starts at 1
(the init value), increments with each step from the previous value by 2 (the increment value),
and stops once it reaches (or to avoid exceeding) 9 (the terminator value).

>> array = 1:3:9
array =
1 4 7

the increment value can actually be left out of this syntax (along with one of the colons), to use a
default value of 1.

>> ari = 1:5
ari =
1 2 3 4 5

assigns to the variable named ari an array with the values 1, 2, 3, 4, and 5, since the default
value of 1 is used as the incrementer.

Indexing is one-based[7], which is the usual convention for matrices in mathematics. This is
atypical for programming languages, whose arrays more often start with zero.

Matrices can be defined by separating the elements of a row with blank space or comma and
using a semicolon to terminate each row. The list of elements should be surrounded by square
brackets: []. Parentheses: () are used to access elements and subarrays (they are also used to
denote a function argument list).

>> A = [16 3 2 13; 5 10 11 8; 9 6 7 12; 4 15 14 1]
A =
16 3 2 13
5 10 11 8
9 6 7 12
4 15 14 1

>> A(2,3)
ans =

Sets of indices can be specified by expressions such as "2:4", which evaluates to [2, 3, 4]. For
example, a submatrix taken from rows 2 through 4 and columns 3 through 4 can be written as:

>> A(2:4,3:4)
ans =
11 8
7 12
14 1
A square identity matrix of size n can be generated using the function eye, and matrices of any
size with zeros or ones can be generated with the functions zeros and ones, respectively.

>> eye(3)
ans =
1 0 0
0 1 0
0 0 1
>> zeros(2,3)
ans =
0 0 0
0 0 0
>> ones(2,3)
ans =
1 1 1
1 1 1

Most MATLAB functions can accept matrices and will apply themselves to each element. For
example, mod(2*J,n) will multiply every element in "J" by 2, and then reduce each element
modulo "n". MATLAB does include standard "for" and "while" loops, but using MATLAB's
vectorized notation often produces code that is easier to read and faster to execute. This code,
excerpted from the function magic.m, creates a magic square M for odd values of n (MATLAB
function meshgrid is used here to generate square matrices I and J containing 1:n).

[J,I] = meshgrid(1:n);
A = mod(I+J-(n+3)/2,n);
B = mod(I+2*J-2,n);
M = n*A + B + 1;


Unlike many other languages, where the semicolon is used to terminate commands, in MATLAB
the semicolon serves to suppress the output of the line that it concludes.


Function plot can be used to produce a graph from two vectors x and y. The code:

x = 0:pi/100:2*pi;
y = sin(x);

produces the following figure of the sine function:
Three-dimensional graphics can be produced using the functions surf, plot3 or mesh.

[X,Y] = meshgrid(-10:0.25:10,- [X,Y] = meshgrid(-10:0.25:10,-
10:0.25:10); 10:0.25:10);
f = sinc(sqrt((X/pi).^2+(Y/pi).^2)); f = sinc(sqrt((X/pi).^2+(Y/pi).^2));
mesh(X,Y,f); surf(X,Y,f);
axis([-10 10 -10 10 -0.3 1]) axis([-10 10 -10 10 -0.3 1])
xlabel('{\bfx}') xlabel('{\bfx}')
ylabel('{\bfy}') ylabel('{\bfy}')
zlabel('{\bfsinc} ({\bfR})') zlabel('{\bfsinc} ({\bfR})')
hidden off
This code produces a wireframe 3D plot of the This code produces a surface 3D plot of the
two-dimensional unnormalized sinc function: two-dimensional unnormalized sinc function:

Object-Oriented Programming
MATLAB's support for object-oriented programming includes classes, inheritance, virtual
dispatch, packages, pass-by-value semantics, and pass-by-reference semantics.[8]

classdef hello
function doit(this)

When put into a file named hello.m, this can be executed with the following commands:

>> x = hello;
>> x.doit;

For a long time there was criticism that because MATLAB is a proprietary product of The
MathWorks, users are subject to vendor lock-in.[9][10] Recently an additional tool called the
MATLAB Builder under the Application Deployment tools section has been provided to deploy
MATLAB functions as library files which can be used with .NET or Java application building
environment. But the drawback is that the computer where the application has to be deployed
needs MCR (MATLAB Component Runtime) for the MATLAB files to function normally. MCR
can be distributed freely with library files generated by the MATLAB compiler.

MATLAB, like Fortran, Visual Basic and Ada, uses parentheses, e.g. y = f(x), for both
indexing into an array and calling a function. Although this syntax can facilitate a switch
between a procedure and a lookup table, both of which correspond to mathematical functions, a
careful reading of the code may be required to establish the intent.

Many functions have a different behavior with matrix and vector arguments. Since vectors are
matrices of one row or one column, this can give unexpected results. For instance, function
sum(A) where A is a matrix gives a row vector containing the sum of each column of A, and
sum(v) where v is a column or row vector gives the sum of its elements; hence the programmer
must be careful if the matrix argument of sum can degenerate into a single-row array.[11] While
sum and many similar functions accept an optional argument to specify a direction, others, like
plot,[12] do not, and require additional checks. There are other cases where MATLAB's
interpretation of code may not be consistently what the user intended[citation needed] (e.g. how spaces
are handled inside brackets as separators where it makes sense but not where it doesn't, or
backslash escape sequences which are interpreted by some functions like fprintf but not
directly by the language parser because it wouldn't be convenient for Windows directories). What
might be considered as a convenience for commands typed interactively where the user can
check that MATLAB does what the user wants may be less supportive of the need to construct
reusable code.[citation needed]

Array indexing is one-based which is the common convention for matrices in mathematics, but
does not accommodate any indexing convention of sequences that have zero or negative indices.
For instance, in MATLAB the DFT (or FFT) is defined with the DC component at index 1
instead of index 0, which is not consistent with the standard definition of the DFT in any
literature. This one-based indexing convention is hard coded into MATLAB, making it difficult
for a user to define their own zero-based or negative indexed arrays to concisely model an idea
having non-positive indices.

Code written for a specific release of MATLAB often does not run with earlier releases as it may
use some of the newer features. To give just one example: save('filename','x') saves the
variable x in a file. The variable can be loaded with load('filename') in the same MATLAB
release. However, if saved with MATLAB version 7 or later, it cannot be loaded with MATLAB
version 6 or earlier. As workaround, in MATLAB version 7 save('filename','x','-v6')
generates a file that can be read with version 6. However, executing
save('filename','x','-v6') in version 6 causes an error message.

Interactions with other languages
MATLAB can call functions and subroutines written in the C programming language or Fortran.
A wrapper function is created allowing MATLAB data types to be passed and returned. The
dynamically loadable object files created by compiling such functions are termed "MEX-files"
(for MATLAB executable). [13][14]

Libraries written in Java, ActiveX or .NET can be directly called from MATLAB and many
MATLAB libraries (for example XML or SQL support) are implemented as wrappers around
Java or ActiveX libraries. Calling MATLAB from Java is more complicated, but can be done
with MATLAB extension[15], which is sold separately by MathWorks.

Through the MATLAB Toolbox for Maple, MATLAB commands can be called from within the
Maple Computer Algebra System, and vice versa.

MATLAB has a number of competitors.

There are free open source alternatives to MATLAB, in particular GNU Octave, FreeMat, and
Scilab which are intended to be mostly compatible with the MATLAB language (but not the
MATLAB desktop environment). Among other languages that treat arrays as basic entities (array
programming languages) are APL and its successor J, Fortran 95 and 2003, as well as the
statistical language S (the main implementations of S are S-PLUS and the popular open source
language R).

There are also several libraries to add similar functionality to existing languages, such as Perl
Data Language for Perl and SciPy together with NumPy and Matplotlib for Python.

See also: list of numerical analysis software and comparison of numerical analysis software

Release history
version[16] release name Year
MATLAB 1.0 R? 1984
MATLAB 2 R? 1986
MATLAB 3 R? 1987
MATLAB 3.5 R? 1990
MATLAB 4 R? 1992
MATLAB 4.2c R7 1994
MATLAB 5.0 R8 1996
MATLAB 5.1.1 R9.1
MATLAB 5.2 R10
MATLAB 5.2.1 R10.1
MATLAB 5.3 R11
MATLAB 5.3.1 R11.1
MATLAB 6.0 R12 2000
MATLAB 6.1 R12.1 2001
MATLAB 6.5 R13 2002
MATLAB 6.5.1 R13SP1
MATLAB 6.5.2 R13SP2
MATLAB 7.0.1 R14SP1
MATLAB 7.0.4 R14SP2
MATLAB 7.2 R2006a
MATLAB 7.3 R2006b
MATLAB 7.4 R2007a
MATLAB 7.5 R2007b
MATLAB 7.6 R2008a
MATLAB 7.7 R2008b
MATLAB 7.8 R2009a 2009