This week’s lecture was captivating as it combined the principles of linear algebra with string manipulation techniques in MATLAB. Dr. Syaza introduced alternative approaches to solving simultaneous equations beyond using the linsolve function. Two notable methods we explored were the backslash operator (\), also called backward division, and the inv function. From the exercises, I learned that solving systems of equations requires matrices of specific dimensions: a 2x2 matrix paired with a 2x1 matrix for two unknowns, and similarly, a 3x3 matrix with a 3x1 matrix for three unknowns, continuing in this pattern.
We also delved into the topic of strings, which are used to represent and manipulate text. Strings are created by enclosing characters in single or double quotes. MATLAB treats single-quoted strings as arrays of characters, while double-quoted strings are interpreted as a single entity. The lecture provided practical insights into solving systems of equations and working with strings, making it both informative and engaging.
A. Solving Systems of Equations in MATLAB
Methods to Solve Equations:
linsolve(A, B): Efficiently solves linear equations.
inv(A) * B: Uses the inverse of matrix A.
A\B: Solves equations using the backslash operator.
B. Introduction to Strings
Understanding Strings:
Strings are arrays of characters that can be accessed, modified, or compared.
Key Functions:
size(example): Returns the dimensions of a string.
num2str(455): Converts numbers to strings.
upper(example) and lower(example): Change string case.
strcmp(string1, string2): Compares two strings (case-sensitive).
strncmp(string1, string2, n): Compares the first n characters of two strings.
This week's combination of theoretical concepts and practical applications was both challenging and rewarding.
Coding for Solving Simultaneous Equations with Two Different Methods
Output of Coding for Solving Simultaneous Equations with Two Different Methods