**8. Simulation for EMG signal generation (EMG simulator)**

The best modeling of clinical EMG signals was achieved in algorithm by A. Hamilton and D. W. Stashuk at 2005 (Hamilton & Stashuk ,2005). This algorithm is simulated by using MATLAB software and using the GUI approach to get full mathematical simulated model for generating real EMG signal of a specific human arm muscle as shown in Fig. 5 .

This simulator has many options used with rearrangement to generate EMG signal for human arm muscle. The option of the simulator can be summarized as:

Muscle: This popup shows the muscle being simulated. One can select from the list ( which adding for human arm muscles), of already defined muscles or select "Custom." to define a new one. Clicking the edit button allows one to modify the muscle parameters. Helping for specification of human arm muscles is added to this window to help the user to generate EMG data more nearest to clinical data, Fig. 6 shows the window for this option.

Electrode: This popup shows the electrode being simulated. The user can select from the list of already defined electrodes or select "Custom..." to define a new one. Clicking the edit button allows the user to modify the electrode parameters. The "Electrode" panel allows the user to save new or modified sets of electrode parameters. Selecting "Multiple Electrodes" allows the user to simulate simultaneous recordings from more than one electrode. Select "Add" from the number popup to add a new electrode. Each electrode can be of a different

type. If the user specifies multiple electrodes, then the program creates separate data files for each electrode. The signal from the first electrode is still named filename.dat, and the signals from the other electrodes are named filenameI.dat, where "I" is the electrode number. Fig .7 shows the window for this option.


**Figure 5.** The EMG Signal Simulator.

Advanced: This allows the user to specify some advanced simulation preferences. Include all units: This causes the firing patterns of all the active motor units to be included in the annotation file, not just the ones closest to the electrode.

Output directory: Specifies the directory in which to write the data files. The default directory is the data subdirectory in the simulator directory.

Output root filename: Specifies the root filename for the output files.

Signal duration: Specifies the length of each signal, in seconds.

Contraction: Selects a contraction. To add additional contractions select "Add" from the popup.

%MVC: Specifies the contractile level for the selected contraction.

Position: Specifies the x, y, and z electrode locations (in mm) for the selected contraction. The z coordinate is the distance from the muscle endplate along the muscle axis. Use the "electrode" popup to specify locations for multiple electrodes. Note that you can specify different locations for each electrode in each contraction.

Delete: Deletes the current contraction.

374 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 1

shows the window for this option.

**Figure 5.** The EMG Signal Simulator.

popup.

annotation file, not just the ones closest to the electrode.

directory is the data subdirectory in the simulator directory.

Signal duration: Specifies the length of each signal, in seconds.

%MVC: Specifies the contractile level for the selected contraction.

different locations for each electrode in each contraction.

Output root filename: Specifies the root filename for the output files.

type. If the user specifies multiple electrodes, then the program creates separate data files for each electrode. The signal from the first electrode is still named filename.dat, and the signals from the other electrodes are named filenameI.dat, where "I" is the electrode number. Fig .7

Advanced: This allows the user to specify some advanced simulation preferences. Include all units: This causes the firing patterns of all the active motor units to be included in the

Output directory: Specifies the directory in which to write the data files. The default

Contraction: Selects a contraction. To add additional contractions select "Add" from the

Position: Specifies the x, y, and z electrode locations (in mm) for the selected contraction. The z coordinate is the distance from the muscle endplate along the muscle axis. Use the "electrode" popup to specify locations for multiple electrodes. Note that you can specify Run Simulation. Runs the specified set of simulations (one simulation per electrode per contraction). The simulations can take a fair amount of time, depending on the specified signal duration. The trace statements from the simulation routines are displayed in the command window.

Cancel. Quits the simulator and returns to MATLAB.

After press the " Run Simulation " button , each simulation may take a minute or more. The program creates the following files for each contraction:

Filename.dat →→ EMG signal, Filename.hea →→ header file (allows signals to be read by software).,Filename.eaf. →→ annotation file, These files can be used to analysis the EMG signal. The real value of the muscle parameters can be obtained by studying the anatomy of muscles in detail. Depending on the practical data obtained from medical table and consultation with the specialist, the muscle parameters adopted are as shown in table 2. Fig.5 represents the generation of EMG signal by EMG simulator. There are two choices to get the EMG data. The first one is by EMG simulator with specified values for the parameters of the muscle as shown in figure 6. The second choice is used to produce data of EMG signal by selecting a specific muscle of the human arm as shown in figure 7. The data are calculated by selecting the specification of normal human body as given in table 2


**Figure 6.** Window for the Selection or Design of Human arm Muscle


**Figure 7.** Window for Selecting the Type of Electrode


**Table 2.** Standard Parameters of Muscle Human Arm
