Lab 1: Basic Decimal MATLAB
Lab 1: Basic Decimal MATLAB
Introduction
The following lab is a precursor to the rest of the labs for the semester in Signals and Systems, of which will all use a program known as MATLAB. MATLAB is a programming language and environment used for math, data analysis, and visualization. It enables users to perform complex calculations, process and analyze data, and create visual representations. The basic intent of MATLAB as a program is to make working with matrices easier, which is what separates it from regular calculators. Variable definitions, comment creation, and matrix fundamentals will all be explored in the following lab report and respective MATLAB file.
Procedure
1. Why do we clear the command window and workspace at the beginning of a script?
The command window and workspace are cleared at the beginning of a script to ensure interference with unwanted values are mitigated. If the current program has nothing to do with an older program, any previous saved values will cause problems. “clc” clears the command window whereas “clear” deletes any saved variables.
2. Why would we use variables instead of just using the numbers, which is called hard-coding?
Variables would be used instead of just using the numbers, known as hard-coding, for accessibility, it is easier to reference this way especially if numbers are extensive. It would take a lot of time and make the process significantly more difficult if numbers had to be retyped multiple times.
3.What system would you use to organize your variables and remember what each means?
System of naming would be used to organize variables and remember what each means. For instance, when dealing with multiple impedances that require operations, it can be helpful to label them as Impedance1, Impedance2, and so on. Comments may also be useful. A percent sign may be used to create a comment which will not be acted on by a program but rather used for a users reference. A comment’s text will be green.
4. What are the benefits to using the array indexing approach?
A benefit to using the array indexing approach is in locating particular values within extensive datasets. It simplifies code by referencing elements directly, making it especially useful for complex data structures.
5. In your opinion, would the automatically generated variable ans or a user-defined variable be more useful in writing scripts?
Personally, I believe a user-defined variable would be more useful in writing scripts because it can be referenced throughout the code and through future iterations whereas an automatically generated variable ans would only be referenced after command is executed.
Conclusion
I enjoyed the straightforward procedure and questions of the lab; it helped in relieving higher stress expectations. A straightforward procedure as the first lab of the semester is a good way to begin as it gets the student comfortable with lab habits after not being in school for an extended period. The instructions were also easy to follow, which is beneficial as it leaves less room for mistakes. I also enjoyed the linear algebra review especially the division part, considering that matlab specializes in matrix mathematics, it was useful to note that. Overall, I am glad to be using MATLAB for the remainder of the semester as I understand that it plays a major role in electrical engineering for system testing and validation.
Comments
Post a Comment