Coding Flashcards
\the process of allocating memory at runtime, rather than at compile time. You can use the malloc and calloc functions to dynamically allocate memory for one-dimensional arrays, and the realloc function to change the size of a dynamically allocated array. You should use the free function to release dynamically allocated memory when you are finished with it.
Dynamic memory allocation
a special value that indicates the end of a file or an error in file input/output operations. When the fscanf or fgets functions reach the end of a file, they return the EOF flag. You can use the feof function to check for the EOF flag, and the ferror function to check for errors in file operations.
EOF flag
a control statement in C that causes the loop to terminate immediately and transfer control to the next statement after the loop. For example: “for (int i = 0; i < 10; i++) { if (i == 5) break; … }” terminates the loop when i reaches 5.
“break” statement
a control statement in C that causes the loop to skip the rest of its body and continue with the next iteration. For example: “for (int i = 0; i < 10; i++) { if (i % 2 == 0) continue; … }” skips the even values of i.
“continue” statement
a special value that indicates the end of a file or an error in file input/output operations. When the fopen function fails to open a file, it returns a NULL pointer. When the fscanf or fgets functions reach the end of a file, they return the EOF (end-of-file) flag.
NULL file address
a variable that stores the address of a FILE object, which represents a stream (i.e., a sequence of bytes) associated with a file or other input/output device. You can use the fopen function to open a file and get a pointer to a FILE object, and the fclose function to close the file and release the pointer.
Pointer variable of the FILE type
In C, the & operator is used to get the address of a variable, and the * operator is used to access the value
Pointer operators (&, *) and their functions
In C, variables can be classified as local, static, or global based on their scope. A local variable is a variable that is declared within a function and is only visible within that function. A static variable is a variable that is declared within a function and retains its value between function calls. A global variable is a variable that is declared outside of any function and is visible to all functions in the program.
Local, static, global variables
are used to read data from and write data to files or other devices. In C, you can use the fopen, scanf, fscanf, printf, and fprintf functions to perform I/O operations. The fopen function is used to open a file, the scanf and fscanf functions are used to read data from the standard input or a file, the printf and fprintf functions are used to write data to the standard output or a file.
I/O statements
are used to make decisions based on the value of a condition. In C, you can use the if statement and the switch statement to make decisions. The if statement has a condition and a block of code to be executed if the condition is true. The switch statement has a variable and a list of cases, with each case representing a different value of the variable.
Decision statements
are used to execute a block of code repeatedly. In C, there are two types of looping statements: for loops and while loops. A for loop has a loop control variable, a starting value, an ending value, and a step. A while loop has a condition that is checked before each iteration.
Looping statements
a collection of variables of the same type, stored in contiguous memory locations. To declare an array in C, you need to specify its name, type, and size. To access an element of an array, you can use its index.
Arrays
An arithmetic expression is a combination of variables, constants, and operators that represents a computation. In C, you can use the usual arithmetic operators (+, -, *, /, %) to perform arithmetic calculations.
Arithmetic expressions
you need to declare it before calling it. A function declaration tells the compiler about the function’s name, return type, and parameters.
Function declaration
a block of code that performs a specific task. In C, you can define your own functions or use functions from libraries. To define a function, you need to specify its name, return type, and the types and names of its parameters.
Functions
which are numbers that do not have a decimal point. In C, you can perform basic arithmetic operations such as addition, subtraction, multiplication, and division on integers.
Integer arithmetic
used to store data. A variable has a name, a type, and a value. There are several types of variables in C, including integers, floating-point numbers, characters, and arrays. To declare a variable in C, you need to specify its name and type.
Types and declaration of variables
used to measure the similarity between two signals. There are three main types of correlation: auto-correlation, cross-correlation, and partial correlation. Auto-correlation measures the similarity between a signal and a delayed version of itself. Cross-correlation measures the similarity between two different signals. Partial correlation measures the similarity between two signals while controlling for the influence of one or more other signals. The correlation functions are typically plotted as a function of the delay between the two signals being correlated. The shape and location of the correlation function can provide information about the relationship between the two signals.
Correlation Methods
There is a difference in resolution between analog, discrete, and digital signals. Analog signals have continuous amplitude and time resolution, while discrete signals have quantized amplitude and time resolution. Digital signals have further quantized amplitude and time resolution, and are represented by a sequence of digital values.
Resolution of Analog, Discrete, and Digital Signals
The first and second derivatives of a signal represent the rate of change and the acceleration of the signal, respectively. These derivatives can provide information about the shape and characteristics of the signal.
First and Second Derivatives of a Signal
ECG (electrocardiogram) and EEG (electroencephalogram) signals are used to measure the electrical activity of the heart and brain, respectively. An ECG signal consists of several waves that reflect different aspects of the cardiac cycle, including the P wave, QRS complex, and T wave. A lead refers to a specific orientation of the electrodes used to measure the ECG signal.
ECG and EEG Signals
Time-domain event detection algorithms are used to analyze signals in order to detect specific events or patterns. These algorithms are used in a variety of applications, including medical monitoring, speech recognition, and control systems.
Time-Domain Event Detection Algorithms
The Nyquist criterion states that, in order to accurately represent a signal in the frequency domain, the sampling rate must be at least twice the highest frequency in the signal. If the sampling rate is not high enough, frequencies above the Nyquist frequency will be “aliased” down to frequencies below the Nyquist frequency, resulting in an error in the frequency domain representation of the signal. This error is known as aliasing error.
Nyquist Criterion and Aliasing Error
The resolution of the amplitude frequency spectrum of a digital signal is determined by the number of samples in the signal. The more samples you have, the finer the resolution will be. However, increasing the number of samples can also increase the computational complexity of the analysis.
Resolution of Amplitude Frequency Spectrum for Digital Signal