Feedback and Control Systems: MATLAB Fundamentals, Laplace Transforms, and Transfer Functions
MATLAB Environment and Interface Fundamentals
Overview of MATLAB:
MATLAB (Matrix Laboratory) is a high-level programming language and interactive environment tailored for numerical computation, data analysis, visualization, algorithm development, and application development.
It allows engineers and scientists to explore multiple computational approaches and solve mathematical problems significantly faster than using traditional spreadsheets or low-level programming languages such as C, C++, or Java.
Core Applications:
Signal processing and communications
Image and video processing
Control systems engineering (calculating transfer functions, determining root locus, and analyzing time response)
Test and measurement systems
Computational finance
Computational biology
Key Features:
High-level language for numerical computation and application development.
Interactive environment for iterative design, data exploration, and problem-solving.
Built-in mathematical functions covering linear algebra, statistics, Fourier analysis, filtering, optimization, numerical integration, and ordinary differential equations (ODEs).
Graphics tools for standard data visualization and custom plotting.
Development tools for code quality, debugging, performance optimization, and maintainability.
Graphical user interface (GUI) building tools.
Functions for integrating MATLAB algorithms with external applications written in C, Java, .NET, and Microsoft Excel.
Simulink Companion Tool:
Simulink is a block-diagram environment integrated with MATLAB designed for multidomain simulation and model-based design.
In control systems, Simulink is utilized for simulating dynamical systems and graphing complex output responses.
User Interface Layout (Five Core Areas):

1. Command Window: The primary text interface where commands are entered at the prompt marker
>>. It acts similarly to the Windows Command Prompt (cmd) or Linux terminal. Commands likewhyorhelp whycan be issued directly here.2. Command History: Logs all commands entered into the Command Window during previous and current sessions, allowing users to track and reuse past code.
3. Current Folder: Works as an embedded file explorer to navigate working directories and manage files.
4. Workspace: Displays all variables currently created or loaded into memory, showing variable names, current values, sizes, and data types/classes.
5. Toolstrip: The top toolbar organized into tabs, similar to Microsoft Office ribbons:
Home Tab: Contains controls for file handling, variable management, workspace operations, layout customization, and environment preferences.
Plots Tab: Facilitates one-click plotting of variables selected in the Workspace.
Apps Tab: Houses specialized toolboxes for specific engineering disciplines (e.g., Image Processing, Digital Signal Processing).
Layout Modification: The interface configuration can be modified under the HOME tab by selecting Environment Layout.
MATLAB Basics and Matrix Operations
Variable Assignments:
Assigning a scalar value: entering
a = 1creates a variable storing a floating-point number (default typedouble).Default variable
ans: if a command returns a result without an explicit destination variable, MATLAB stores the result inans(short for answer).Suppressing output: placing a semicolon
;at the end of a command executes the statement but suppresses output display in the Command Window (e.g.,e = a*b;).
Array and Matrix Creation:
MATLAB operates natively on whole matrices and arrays. All variables are treated as multidimensional arrays.
Row Vector Creation: Separate elements with spaces or commas: Command syntax:
a = [1 2 3 4]ora = [1, 2, 3, 4].Matrix Creation: Separate rows with semicolons: Command syntax:
a = [1 2 3; 4 5 6; 7 8 10].Built-in Matrix Generators:
zeros(m, n)creates an matrix of zeros (e.g.,z = zeros(5,1)creates a column vector of zeros).ones(m, n)creates an matrix of ones.rand(m, n)creates an matrix of uniformly distributed random numbers.
Matrix and Element-Wise Arithmetic Operations:
Scalar Addition:
a + 10adds to every element in matrixa.Function Application:
sin(a)computes the sine of each individual element in radians.Matrix Transpose: The single quote
'transposes a matrix (e.g.,a').Standard Matrix Multiplication: The
*operator performs linear algebra matrix multiplication: Command syntax:p = a*inv(a).Display Formats: MATLAB stores numbers as double-precision floating-point values:
format short: displays 4 decimal places (default).format long: displays 15 decimal places.Note: The
formatcommand alters display output only and does not impact internal precision or mathematical calculations.
Element-Wise Operations: Preceding an operator with a dot
.forces element-by-element evaluation rather than linear algebra operations:.*Element-wise multiplication (e.g.,p = a.*a)../Element-wise division..^Element-wise exponentiation (e.g.,a.^3raises each element ofato the third power).
Array Concatenation:
Square brackets
[]act as the concatenation operator.Horizontal Concatenation: Joins matrices side-by-side using commas or spaces (requires matching row counts):
A = [a, a]Vertical Concatenation: Stacks matrices vertically using semicolons (requires matching column counts):
A = [a; a]
Array Indexing:
Two-Subscript Indexing: Reference elements using
A(row, column). For example,A(4,2)accesses the element at row 4, column 2.Linear Indexing: Uses a single subscript
A(k)traversing down columns sequentially. For a matrix, elementA(8)corresponds to row 4, column 2.Index Out of Bounds: Referencing an out-of-bounds element on the right side of an assignment generates an error. Referencing outside bounds on the left side (e.g.,
A(4,5) = 17) dynamically expands the array size, padding unassigned elements with zeros.Colon Operator
:Usage:Sub-range selection:
A(1:3, 2)selects rows 1 through 3 in column 2.Full dimension selection:
A(3, :)selects all columns in row 3.Equally spaced vector generation:
start:step:end(e.g.,B = 0:10:100yields values from to incremented by ). Omittingstepdefaults to an increment of (start:end).
Character Strings:
Strings are sequences of characters enclosed in single quotes (e.g.,
myText = 'Hello, world').Including a single quote within a string requires typing two consecutive single quotes:
otherText = 'You''re right'yieldsYou're right.Data type/class is
char. String variables are stored as character arrays.Concatenating strings:
longText = [myText, ' - ', otherText].Conversion functions:
num2str(x)converts numerical values to character strings;int2str(x)converts integers.
Help Systems:
doc <function>: Opens detailed documentation in a standalone help window.help <function>: Displays text documentation inside the Command Window (e.g.,help mean,help sin,help max,help rand).
2D Plotting:
plot(x, y): Generates a basic line plot.Adding labels and titles:
xlabel('x')adds horizontal axis label.ylabel('sin(x)')adds vertical axis label.title('Plot of the Sine Function')adds plot title.
Line formatting specs:
plot(x, y, 'r--')plots a red dashed line;'g:*'plots a green dotted line with asterisk markers.Overlaying plots: calling
plotclears existing figure windows by default. To overlay graphs, usehold on. To release the overlay mode, usehold off.matlab x = 0:pi/100:2*pi; y = sin(x); plot(x,y) hold on y2 = cos(x); plot(x,y2,'r:') legend('sin','cos') 
Polynomial Handling:
Polynomials are represented as row vectors containing coefficients ordered by descending powers.
Example: is represented as
p = [1 0 -2 -5].
polyval(p, x): Evaluates polynomialpat scalar valuex(e.g.,polyval(p, 5)returns ).polyvalm(p, X): Evaluates polynomialpin a matrix sense () for a square matrixX.roots(p): Calculates the roots of polynomialpand returns them in a column vector.poly(r): Constructs polynomial coefficients given a vector of rootsr.conv(p1, p2): Performs polynomial multiplication (algebraic convolution) (e.g.,p3 = conv([1 2 3], [2 0 5])).
MATLAB Programming: Control Flow, M-Files, and Functions
M-Files:
Text files containing MATLAB commands saved with a
.mfile extension.Key utility commands used inside m-files:
clc: Clears the Command Window display.clear: Erases all variables from the Workspace memory.disp('string'): Prints text or variable contents to the Command Window.
Control Flow Statements:
Conditional Statements:
if,elseif,else,endstructure:matlab a = randi(100, 1); if a < 30 disp('small') elseif a < 80 disp('medium') else disp('large') end switch,case,otherwise,endstructure: used for discrete equality checks.matlab [dayNum, dayString] = weekday(date, 'long', 'en_US'); switch dayString case 'Monday' disp('Start of the work week') case 'Friday' disp('Last day of the work week') otherwise disp('Weekend!') end
Loop Statements:
forloops: Execute a code block a specified number of times with an incrementing index variable.matlab x = ones(1,10); for n = 2:6 x(n) = 2 * x(n - 1); end whileloops: Repeat execution as long as a evaluated conditional statement remains true.matlab n = 1; nFactorial = 1; while nFactorial < 1e100 n = n + 1; nFactorial = nFactorial * n; end
Loop Termination Control:
break: Terminates loop execution prematurely.continue: Skips the remainder of the current loop iteration and advances to the next iteration.Ctrl+C: Halts infinite execution loops manually.
Relational Operators:
Relational operators compare arrays element-by-element and return logical arrays containing ones (
true) and zeros (false).<: Less than<=: Less than or equal to>: Greater than>=: Greater than or equal to==: Equal to~=: Not equal to
Scripts vs. Functions:
Scripts: Sequential files that execute commands directly within the base Workspace. They take no input arguments and return no output arguments.
Functions: Programs that accept inputs and return outputs. Declared using the
functionkeyword and stored in a file matching the function name (function_name.m). Functions operate inside their own isolated workspace.Function declaration syntax:
function a = triarea(b,h)matlab function a = triarea(b,h) a = 0.5*(b.* h);
Laboratory Exercises and Activities:
Activity 1a Requirements:
1.a. Add matrices and .
1.b. Compute for and .
1.c. Compute using matrices from item 1.a.
2. Compute where , , and .
3. Compute using matrices from item 2.
4. Plot (red solid line) and (blue dashed line) on a single plot.
5. Plot the signals from item 4 on separate subplots using
subplot.6. Find the roots of polynomials:
a.
b.
c.
7. Compute polynomial convolutions of item 6.a with 6.b, and 6.a with 6.c.
Activity 1b Requirements:
Fibonacci Generator: Function
newFibonacci.maccepting two boundary integers and outputting all Fibonacci numbers within that closed interval.Palindrome Checker: Function verifying whether a string input reads identically forward and backward (e.g.,
racecar,anna).
Laplace Transform Theory and Principles
Role in Control Systems:
Developing mathematical models is a primary phase of control system design.
Dynamic systems are governed by linear time-invariant (LTI) differential equations that map input signals to output signals .
Solving high-order differential equations directly in the time domain is mathematically cumbersome.
The Laplace transform simplifies dynamic system analysis by converting calculus operations (differentiation and integration) into simple algebraic operations in the complex frequency domain (--domain).
Definition of the Laplace Transform:
The unilateral Laplace transform of a time-domain signal is defined by the integral: where is a complex frequency variable.
Initial Condition Evaluation: The lower limit allows system analysis to incorporate initial conditions present immediately prior to initial input disturbances or discontinuities at
Fundamental Laplace Transform Derivations:
Ramp Function : Using integration by parts (where , , , ):
Exponential Function :
Cosine Function : Applying Euler's formula :
Standard Laplace Transform Pairs:

1. Impulse Function:
2. Unit Step Function:
3. Ramp Function:
4. Polynomial Function:
5. Exponential Decay:
6. Sine Wave:
7. Cosine Wave:
Laplace Transform Theorems & Properties
Summary of Key Laplace Theorems:

Definition Theorem:
Linearity Theorems:
Frequency Shift Theorem:
Time Shift Theorem:
Scaling Theorem:
First Differentiation Theorem:
Second Differentiation Theorem:
-th Differentiation Theorem:
Integration Theorem:
Final Value Theorem:
Initial Value Theorem:
Applications of Theorems (Review Derivations):
Damped Sine Wave: Deriving Applying Frequency Shift Theorem to Pair 6 ():
Damped Cosine Wave: Deriving Applying Frequency Shift Theorem to Pair 7 ():
Cubic Power: Deriving Applying Pair 4 for :
Inverse Laplace Transform and Partial Fraction Expansion
Definition of the Inverse Laplace Transform:
The complex inversion integral reconstructs the time-domain signal from :
Because direct evaluation of this complex surface integral is difficult, Partial Fraction Expansion (PFE) combined with transform tables is used instead.
Partial Fraction Expansion (PFE) Principles:
For a rational function , the order of the numerator must be strictly less than the order of the denominator .
If the degree of degree of , polynomial long division must be performed first until the fraction displays a remainder numerator of lower degree than its denominator:
PFE Case 1: Real and Distinct Roots:
Given , expand into distinct linear fractions:
Calculate residue by multiplying by and setting :
Calculate residue by multiplying by and setting :
Inverse transform result:
PFE Case 2: Real and Repeated Roots:
Given , expand accounting for root multiplicity:
Calculate distinct residue :
Calculate highest-power repeated residue :
Calculate lower-power repeated residue using differentiation:
Inverse transform result:
PFE Case 3: Complex Conjugate Roots:
Given , write quadratic factor directly:
Solve for :
Equate numerator coefficients ():
Resulting expansion:
Solving Differential Equations using Laplace Transforms:
Problem Statement: Solve for given with zero initial conditions.
Step 1: Transform equation into -domain:
Step 2: Isolate Output :
Step 3: Perform Partial Fraction Expansion:
Step 4: Take Inverse Laplace Transform:
The Transfer Function
Concept and Definition:

A transfer function is an algebraic model representing the ratio of the Laplace transform of the output variable to the Laplace transform of the input variable, assuming zero initial conditions.
Mathematical definition:
General Derivation for an -th Order LTI Differential Equation:
Given an -th order differential equation with constant coefficients:
Taking the Laplace transform of both sides under zero initial conditions:
Forming the output-to-input transfer ratio:
Transfer Function Worked Examples:
Example 1 (First-Order Equation): Find for .
Practice Question 1 (First-Order System): Find for .
Practice Question 2 (Second-Order Mechanical System): Find for .
Practice Question 3 (Derivatives on Input Side): Find for .
Electrical Network Transfer Functions
Passive Component Relationships:

Capacitor ( in Farads ):
Voltage-Current relation:
Current-Voltage relation:
Voltage-Charge relation:
-Domain Impedance:
-Domain Admittance:
Resistor ( in Ohms ):
Voltage-Current relation:
Current-Voltage relation:
Voltage-Charge relation:
-Domain Impedance:
-Domain Admittance:
Inductor ( in Henries ):
Voltage-Current relation:
Current-Voltage relation:
Voltage-Charge relation:
-Domain Impedance:
-Domain Admittance:
Single-Loop RLC Circuit Analysis:
Apply Kirchhoff's Voltage Law (KVL) around a series RLC mesh containing input voltage source , inductor , resistor , and capacitor :
Express current in terms of output capacitor voltage using :
Transform to -domain assuming zero initial conditions:
Form the capacitor voltage transfer function :
Multi-Loop Network Analysis via Mesh Equations & Cramer's Rule:
Procedure for Complex Networks:
1. Replace element values with their -domain impedances .
2. Replace time-domain sources and variables with their Laplace transforms.
3. Assign loop currents and establish loop directions.
4. Write KVL mesh equations in matrix form:
5. Solve the system of simultaneous equations using Cramer's rule for the desired output variable.
6. Construct the output-over-input transfer function.
Two-Mesh Example Derivation:
Network configuration: Mesh 1 contains source , series resistor , and shared inductor . Mesh 2 contains shared inductor , series resistor , and capacitor
Mesh KVL Equations:
Solve for Mesh 2 current using Cramer's Rule: where system determinant is:
Expand and simplify :
Form final transfer function :
Operational Amplifier Transfer Functions
Ideal Operational Amplifier Properties:
Differential Input:
High Input Impedance: (ideal, resulting in zero terminal input currents: )
Low Output Impedance: (ideal)
High Constant Voltage Gain: (ideal, leading to virtual short circuit between inputs: )
Inverting Operational Amplifier Circuit:

Non-inverting input (+$) is grounded (v_2(t) = 0v_1(t) \approx 0).\n * Input current equals negative feedback current due to infinite input impedance (I_1(s) = -I_2(s)).\n * Current expressions: I_1(s) = \frac{V_i(s)}{Z_1(s)}-I_2(s) = -\frac{V_o(s)}{Z_2(s)}.\n * Inverting Transfer Function Equation:\n \frac{V_o(s)}{V_i(s)} = -\frac{Z_2(s)}{Z_1(s)}\n\n * *Inverting Op-Amp Numerical Example:*\n * Input impedance Z_1(s)R_1 = 360\,\text{k}\OmegaC_1 = 5.6\,\mu\text{F}:\n Z_1(s) = \frac{1}{C_1 s + \frac{1}{R_1}} = \frac{1}{5.6 \times 10^{-6} s + \frac{1}{360 \times 10^3}} = \frac{360 \times 10^3}{2.016s + 1}\n * Feedback impedance Z_2(s)R_2 = 220\,\text{k}\OmegaC_2 = 0.1\,\mu\text{F}:\n Z_2(s) = R_2 + \frac{1}{C_2 s} = 220 \times 10^3 + \frac{10^7}{s}\n * Substitute into inverting equation:\n \frac{V_o(s)}{V_i(s)} = -\frac{Z_2(s)}{Z_1(s)} = -\frac{220 \times 10^3 + \frac{10^7}{s}}{\frac{360 \times 10^3}{2.016s + 1}} = -1.232 \frac{s^2 + 45.95s + 22.55}{s}\n\n* **Noninverting Operational Amplifier Circuit:**\n \n * Input signal V_i(s)+$).
Output voltage equation:
Feedback voltage divider equation at inverting terminal ():
Substitute into output equation:
For ideal/infinite gain , unity in the denominator is neglected:
Noninverting Op-Amp Impedance Example:
Impedance in series branch to ground:
Impedance in parallel feedback branch:
Substitute and into noninverting transfer function: