filmov
tv
2D and 3D plotting in MATLAB live script | EE MSP 08| Electrical Engineering Education

Показать описание
Welcome to another presentation in #electricalengineering education, Matlab with plotting for mathematics of #signalprocessing. This is a #matlab live script introduces basic Matlab environment, #Matrices and #vectors and the associated operations such as #matrixmultiplication and inverse. #solutionoflinearequations and basic #plotting in #2-D and #3-D. Subplots are also considered.
First of all, we use the 'clear all' command to clear all the variables in the workspace, secondly, the 'close all' command to close the Matlab figures, and finally the 'c-l-c' command is used to clear the command window. The script, actually, start from defining a variable 'A', and initialize with scaler 'pi', which is equal to 3.141592 up to 6 decimal places. We have a semicolon at the end of the statement, meaning the output will not be displayed in either the command window or in this case the output of the #livescript. However, for the rest of #statements, no semicolon
will be used to know that what is happening. Next we generate the 1 by 2 vector 'B', then a 3 by 3 matrix. Note that the each elements are terminated by semicolon. row elements can be either comma separated or by a space between them. We generate three row vectors v-1, v-2 and v-3.
From these vectors, we generate a matrix A, the previous values of A are overwritten. The values of vector B, is again over write with 1 by three vector, meaning, we can dynamically change the size of a matrix, but should be done carefully. This is followed by taking inverse of matrix and multiplying with the vector B. Such situation arises in systems of linear equations. The multiplication of a matrix with its inverse is the identity matrix as shown.
Our next section is plotting in 2-D and 3-D with labels and titles. We generate a row vector x from one to 8. Then we generate y as the square of x, which is known to us. that is, 1, 4, 9, up to 64. We can do this simply by writing y equal x dot square. the two outputs are same. The parabola generated is shown in the plot. The built in function rand is used for random data generation obtained from a #uniformdistribution with values between 0 and 1. randn is used for #Gaussiandistribution with unit variance and zero mean. we can save the data using the. save, command. Its format is save, file-name with mat extension, followed by list of variables. If no variable list is given, the whole workspace variables are saved in the file. we can load the saved file and use its variables. This is usually good for data analysis. Other operations on vectors can be seen such as multiplication with a constant and taking cube of each element. We can generate a single figure having many subplots of different types or special forms. The x-y plot is the most commonly used plot type in MATLAB. Engineers frequently plot either a measured or calculated dependent variable, say y, versus an independent variable, say x. Depending upon the functional form we are plotting we may wish to use a logarithmic scale (base 10) for x or y, or both axes. When a log axes is used the variable may range over many orders of magnitude, yet still show detail at the smaller values. The semilogx(x,y) is used for Linear y versus log of x, semilogy (x,y) is used for Log of y versus linear of x, and the loglog(x,y) is used for Log of y versus log of x. This is hown in subplot format where one figure shows four such plots. please see how to set titles of each.
This channel provides #lectures in #electrical # engineering, #Computerscience, #AI and #IT. There are six pathways including
#communicationsystems
#digitalsignalprocessing
#controlsystems
#digitalelectronics
#programming
#artificialintelligence
The video link for creating animations and movies in MATLAB is
How to analyze sinusoids in matlab and Sum, shifts & delay , please see
For 2D and 3D plotting in MATLAB Please see
How to use MATLAB for Arrays Matrices basic Plotting, see
For Channel Introduction, please see
There are multiple playlists, each subject has its own playlist.
The Signal Processing Playlist can be found at the link
First of all, we use the 'clear all' command to clear all the variables in the workspace, secondly, the 'close all' command to close the Matlab figures, and finally the 'c-l-c' command is used to clear the command window. The script, actually, start from defining a variable 'A', and initialize with scaler 'pi', which is equal to 3.141592 up to 6 decimal places. We have a semicolon at the end of the statement, meaning the output will not be displayed in either the command window or in this case the output of the #livescript. However, for the rest of #statements, no semicolon
will be used to know that what is happening. Next we generate the 1 by 2 vector 'B', then a 3 by 3 matrix. Note that the each elements are terminated by semicolon. row elements can be either comma separated or by a space between them. We generate three row vectors v-1, v-2 and v-3.
From these vectors, we generate a matrix A, the previous values of A are overwritten. The values of vector B, is again over write with 1 by three vector, meaning, we can dynamically change the size of a matrix, but should be done carefully. This is followed by taking inverse of matrix and multiplying with the vector B. Such situation arises in systems of linear equations. The multiplication of a matrix with its inverse is the identity matrix as shown.
Our next section is plotting in 2-D and 3-D with labels and titles. We generate a row vector x from one to 8. Then we generate y as the square of x, which is known to us. that is, 1, 4, 9, up to 64. We can do this simply by writing y equal x dot square. the two outputs are same. The parabola generated is shown in the plot. The built in function rand is used for random data generation obtained from a #uniformdistribution with values between 0 and 1. randn is used for #Gaussiandistribution with unit variance and zero mean. we can save the data using the. save, command. Its format is save, file-name with mat extension, followed by list of variables. If no variable list is given, the whole workspace variables are saved in the file. we can load the saved file and use its variables. This is usually good for data analysis. Other operations on vectors can be seen such as multiplication with a constant and taking cube of each element. We can generate a single figure having many subplots of different types or special forms. The x-y plot is the most commonly used plot type in MATLAB. Engineers frequently plot either a measured or calculated dependent variable, say y, versus an independent variable, say x. Depending upon the functional form we are plotting we may wish to use a logarithmic scale (base 10) for x or y, or both axes. When a log axes is used the variable may range over many orders of magnitude, yet still show detail at the smaller values. The semilogx(x,y) is used for Linear y versus log of x, semilogy (x,y) is used for Log of y versus linear of x, and the loglog(x,y) is used for Log of y versus log of x. This is hown in subplot format where one figure shows four such plots. please see how to set titles of each.
This channel provides #lectures in #electrical # engineering, #Computerscience, #AI and #IT. There are six pathways including
#communicationsystems
#digitalsignalprocessing
#controlsystems
#digitalelectronics
#programming
#artificialintelligence
The video link for creating animations and movies in MATLAB is
How to analyze sinusoids in matlab and Sum, shifts & delay , please see
For 2D and 3D plotting in MATLAB Please see
How to use MATLAB for Arrays Matrices basic Plotting, see
For Channel Introduction, please see
There are multiple playlists, each subject has its own playlist.
The Signal Processing Playlist can be found at the link
Комментарии