Lab Report - Lab 1: Basic Decimal Matlab

Introduction

The goal for this lab is to provide a simple introduction to Matlab functions and scripts. We will be working with basic decimal numbers and arithmetic operations. Additionally, we will explore the use of variables and the display of results. These variables will include basic integers and matrix values. The lab will cover writing a script to perform basic variable manipulation and arithmetic operations with decimal numbers and matrices.

Procedures


1. Why do we clear the command window and workspace at the beginning of a script?
It is important to clear the command window and varaibles so that similar variable names from other scripts are not being used by accident causing problems within the code. Additionally these commands clear up the program making it easier to see what is going on.
2. Why would we use variables instead of just using the numbers, which is called hard-coding?
Using variables allows us to change one value that can affect the rest of the written operations. For example, if I change my var1 to 4, I do not have to go change every other function to 4
3. What system would you use to organize your variables and remember what each means?
When I name variables I usually follow the rule that the name of the variable is whatever the process that variable represents. For example, above I have my variables named according to the operation that they represent. Where I add the variables I have a varaible named sum.Additionally I like to use "_" between long variable names. Camel case is also a good way to type variables.
4. What are the benefits to using the array indexing approach?
Array indexing is very useful for completing complex calculations very quickly. I dont need to go through the entire matrix to find a value I can just grab the value at the desired index. This is also useful for defining large arrays quickly.
5. In your opinion, would the automatically generated variable ans or a user-defined variable be more useful in writing scripts?
In my opinion, a user defined variabel would be more useful in writing scripts. ans is something that you cannot manipulate within the script easily meanwhile you can simply have a variable that represents your output and have that become ans at the end of the script. This allows for easy debugging utilizng variable checks at certain functions.

Conclusion


What went well?
The lab went well. I was able to complete the lab in a timely manner and I was able to understand the concepts that were being taught. I enjoyed create this website and styling it to my liking.
What didn't go well?
Nothing went wrong during the lab. I was able to complete the lab without any issues.
How would you improve this lab?
I would add more complex operations to the lab. I feel that the lab was a little too easy and I would like to see more complex operations in the future.