Lab Report 2: MATLAB Clayton Hatfield December 1, 2020
Lab Report 2: MATLAB Clayton Hatfield December 1, 2020
Clayton Hatfield
December 1, 2020
Introduction:
The goal of this lab was to become familiar with MATLAB and be able to do basic
equation solving.
Procedure:
When beginning the lab, the first thing that I had to do was log into Vlab and open
MATLAB using the link provided to us. Once MATLAB was open we created a new script
under the name of lab2.m. Three variables were then to be defined, those variables were:
Voltage, Current, and Power. The values that correspond with those variables are: 3,4 and
(Voltage x Current). We then had to have MATLAB display the Power value.
A new variable was added to the script being “t” which represents a time vector being:
t = 0:0.1:10;
Voltage = √2×120cos(2πft)
Current = √2×120cos(2πft+θ)
We then had to take these new values and plot them in various ways involving the change of
the time steps being .5, .01, and .001 and see how this affects our plots. The last step is to plot all
The last part of this lab was to solve the following system of equations:
a) 3x+4y-4z=2;
b) -7x+y+z=5;
c) 6x+3y-z=0;
Calculations:
For this lab, one of the first calculations that I had to do within MATLAB was to find the
first power by using the first voltage and current variables that were given in the first section of
the procedure:
Measurements:
Throughout this lab there were a lot of measurements that I had to take in the form of
plots. The first plot that I made was the power in respect to the voltage and current.
Note: For all the graphs below, use the following legend as a reference: Voltage:
Current:
As well as the X-axis in the time, Y-axis is the value.
Power:
The last part of this lab was to be able to solve the system of equations that was given to
us within the lab. Using the code that is found after the conclusion in the appendix section I was
1. Explain the MATLAB API and what the main parts of MATLAB are in a few short sentences.
- MATLABS API is very useful when accessing features or trying to view data. MATLAB
allows us to easily view functions and their outputs using simple commands while easily
defining variables that we want to test and view.
2. How useful was the MathWorks help when navigating new functions?
- I found MathWorks helpful once I figured out where to go in order to find the answers to
my question as it was tricky for me at first.
3. How did you find MATLAB to be different from other programming languages you have used?
- I feel that MATLAB is a smoother programming language for computations and there are
some parts of it that feel like R-Studio which I use for my Stats-310 class that I am taking
now.
Conclusion:
comfortable with the language itself and its functions. This will allow me to easily test circuits
and view the outputs in a simple and easy to understand plot. Finding the power function while
also being able to view the power and current as sinusoidal waves will be extremely helpful. I
also believe that this tool, MATLAB, would be faster than measuring the actual values of the