## Analysis of M-mode Echocardiogram

### Import of the Original Data

In this section, the original data is downloaded from the data files, and scaling functions are defined and applied to data. Then, a common list of data is formed and displayed. Finally, the heartbeat is calculated.

Enter initial data.

Import the previously recorded data from the files. First, set the working directory.

Enter pwenlist, data points collected along the edges of the posterior wall endocardium.

Display the raw data.

To eliminate the possible artifacts of the input data, sort the data into a canonical list in ascending order of the time coordinate. Display corrected data.

For the following three lists, use the function Sort after reading the files. Enter lseplist, data points collected along the edges of the left septal endocardium.

Enter rrrseplist, data points collected along the edges of the right septal endocardium.

Enter pwoutlist, data points collected along the edges of the posterior wall epicardium.

Form a single list of data.

Enter the greatest depth on the M-mode in mm, realmax; the M-mode image that corresponds to realymax, ymax; 0 cm depth (upper left-hand corner of image), zero; and any two points that are two seconds apart on the time line, xaxis.

Enter qwaves, the points where the Q-wave is initiated for six heart beats on the ECG line.

Form lists of scaled data.

Load the data manipulation, descriptive statistics, and graphics standard packages.

Graph data in the desired format.

Calculate heart rate.

### Interpolation of a Single Cycle with Quartic Polynomials

In this section, a composite cycle is created and displayed. The standard kernel function Fit is used for the data interpolation. The results of the interpolation are then displayed together with the composite cycle.

The function slice creates a composite cycle by superimposing the information from the later cycles on the first cycle.

Apply the function slice to all four walls.

Here is an example of the slice output as applied to the first list.

Interpolate data by quartic polynomials using the standard function Fit. Create the list of interpolated data.

Set desired options for the plot functions, and display the results.

### Calculations and Graphics for the Wall and Chamber: Sizes, Velocities, and Acceleration

In this section, the signals for the left ventricle, the left ventricular posterior wall (LVPW), and the septum are calculated and displayed. First and second derivatives are calculated with the standard kernel function D and displayed.

Ventricle, Left Ventricular Posterior Wall, and Septum Sizes

The size of the left ventricle is calculated as the difference between the coordinate of the left edge of the septum and the coordinate of the LVPW endocardium.

The left ventricular posterior wall (lvpw) coordinate is calculated as the difference between the coordinates of the LVPW endocardium and epicardium.

The septum size is calculated as the difference between the coordinates of the right and left edges of septum.

Display the results.

Left Ventricle: Size, Velocity, and Acceleration

Calculate the rate of change of the size of the ventricle by applying the standard differentiation.

Calculate the acceleration by applying the differentiation function a second time.

Note: Due to the use of quartic polynomials for interpolation, the result of the second derivative will be a quadratic polynomial. It is sufficient for our goals of calculating the difference between the maximum and the minimum values of the derivatives.

Display the results.

Left Ventricular Posterior Wall

Calculate the rate of change of the size of the wall.

Calculate the acceleration.

Display the results.

Septum

Calculate the rate of change of the size of septum.

Calculate the acceleration.

Display the results.