The MathWorks company created the programming language MATLAB. When it first began, linear algebra programming was done using a matrix programming language. It can be executed both as a batch operation and during interactive sessions. The MATLAB programming language is forcefully introduced to you in this session. It is made to help students become proficient in the MATLAB programming language. Simple and straightforward problem-based MATLAB examples have been provided to make learning quick and efficiently.
Control engineers frequently utilise MATLAB, an interactive tool for numerical calculation and data visualisation, for analysis and design. There are numerous toolboxes that expand MATLAB’s fundamental features into other application domains; in these lessons, we will heavily rely on the Control Systems Toolbox. On Unix, Macintosh, and Windows platforms, MATLAB is supported; a student edition of MATLAB is accessible for desktop PCs.
Let’s begin by producing something straightforward, like a vector. Each vector element should be entered between brackets, separated by a space, and set to a variable. For instance, enter the following into the MATLAB command box to create the vector.
Many common functions are included in MATLAB to make things simpler. Each function is a section of code that carries out a certain purpose. All of the common functions, including sin, cos, log, exp, sqrt, and many others, are available in MATLAB. MATLAB also includes frequently used constants like pi and I or j for the square root of -1.
In the MATLAB command window, type help [function name] to find out how to use any function. You can even write your own functions in MATLAB using the function command; click the link to find out how to do that and to view a list of the functions we wrote for this course.
Plots are also simple to make in MATLAB. Consider plotting a sine wave as a function of time. To compute the sin value at each time, first create a time vector (the semicolon after each sentence informs MATLAB we don’t want to see all the data). The plot will have annotations added by the instructions title, x label, and y label that come after the plot function.
The plot is roughly a sine wave with one period. In MATLAB, basic plotting is incredibly simple, and the plot command provides a wide range of add-on features. To find out more, go to the plotting page.
Polynomials as Vectors
A polynomial is represented by a vector in MATLAB. Simply enter each coefficient of the polynomial into the vector in descending order to generate a polynomial in MATLAB.
A vector of length n+1 can be interpreted as an nth order polynomial in MATLAB. Therefore, you must enter zeros at the proper locations in the vector if your polynomial is missing any coefficients.
Polynomials using the S variable
Using the Laplace variable s in MATLAB is another technique to represent a polynomial. This approach is primarily used in these tutorials. For the time being, let’s just use the s variable to represent polynomials and ignore the specifics of the Laplace domain.