Reporter: Elizabeth Setren
On Friday, July 15th, the Sharpies participated in an introductory class to MATLAB and PSPICE computer programming. At one o’clock pm, all of us sat down at individual computers, eager to learn the new programs. Addy and Mehd, both graduate students in electrical engineering at Cal State LA, introduced themselves. They outlined the afternoon session, assigning an hour for MATLAB and PSPICE respectively, allowing time for a short break and a quiz at the end.
To get to know the group better, they asked us what our intended majors were. Answers were broad as Sharpies sited various fields of engineering and science. Despite our wide ranging career interests, Addy assured us that these programs were applicable in various fields and proceeded to introduce a few of its applications. Short for “Matrix Laboratory,” MATLAB utilizes numerical computing to manipulate matrices, plot functions and data, implement algorithms, and to create user interfaces. They showed us the simplest uses for MATLAB: those of a regular calculator. By typing in a simple equation such as 2*2 and pressing enter, the solution appears on the screen. Although this seemed rather simple, we soon learned otherwise. Using a master computer and a program called Link System, all the Sharpies were surprised as Addy opened the program from our desktop. No longer able to perform tasks on our individual computers, we watched and took careful notes of the program and commands that were being typed. We learned how to set values for different variables and how to establish matrices. By typing a variable, the equals sign, the starting number, a colon, the increment number, then the ending number, a simple matrix was written. All of the values of the matrix appeared after the enter button was pressed. Then, we saw that by typing in another variable and bracketing a value of the first variable, or a range of the first variable, specific numbers of the matrix could be displayed.
The lesson became increasingly complex as we learned how to graph a simple function, y=cos(x) (see figure). X=linspace(0,(pi),100) was inputted, the commas replacing the colons of the earlier exercise. Linspace was used because pi was a value. Then, the equation of the line was typed and to display the graph, plot (x,y) was inputted. A small graph then came up on the screen. To complete the graph, the x and y axis were labeled by typing xlabel(‘x’) and ylabel(‘y’). The title was displayed by typing title(‘cos(x)’). After the graph was completed, we were shown how having more points in a graph makes it more accurate. Instead of the original 100 points for the graph, Addy lessened the number of points to 10. Then, instead of a curve, the graph was a straight line: highly inaccurate.
Next, we learned how to input a program containing conditions. They drew on the board a series of conditions with triangles and rectangles enclosing the variables. For each statement there was an arrow branching off for either true or false, then conditions for those respective branches. After seeing this, we were shown how to type the conditions into the computer. The required variables were defined as a=input (‘enter number a: ’) and the values were designated later. The conditionals were typed using the word if and then an equation in parenthesis. For false statements, else was used and end was used when a path was concluded. The program was then saved as an M file and opened so the program could be run and the results determined.
Next, we watched as a more complicated program was written. Through this, we learned that by typing the percent sign notes could be added to a program. The title, date, and explanation of the program and its variables were typed. We were informed that all engineers had to add in these explanations at each step of their program so that if they were to leave their job, the program could be completed. This specific program was created to calculate the distance traveled by a ball thrown in the air at varied angles. Typing the program took a lengthy amount of time. Sharpies took notes or watched attentively to learn the various abbreviations and modes used in MATLAB. When the program was almost completed, we were given a short five minute break. Upon our return, we saw the graph of the ball’s flight and saw that its maximum range was obtained at a 45° angle. Some of us asked questions about what various commands meant and the resulting program. We also learned that in college, MATLAB is its own specific course, and the work that we did in that hour was typically covered over a quarter. For those of us who were a bit befuddled by all of the different commands, this was a relief.
After seeing Addy and Mehd use MATLAB, it was our turn to test our new skills. An equation for a projectile was written on the board along with certain givens. Looking through our notes and helping each other, everyone eventually understood how to draw the graph. Then we were given a more challenging graph and everyone drew it successfully. We then had another short break before learning PSPICE. Some students took the opportunity to ask Addy and Mehd about Link System, the program that established a master computer that could view and control all the computer screens in the room. We learned that the program is used often by professors in electrical engineering classes and that sometimes a professor will display a student’s screen to reveal their inattentiveness.
After the break, we were informed that PSPICE was in the family of the SPICE programs and was used for circuit analysis. Upon being asked if we had studied circuits and were aware of Ohms Law, the majority of the Sharpies responded in the affirmative. Then, a simple circuit was drawn on the board. Using Ohms Law, we calculated the different values present. Then we were shown how this circuit could be drawn in PSPICE by selecting the specific symbols for the energy source, resistors, and ground. By rotating and placing the parts in the correct position and linking them by a wire tool, the circuit was drawn. Then, the known values were inputted by selecting specific parts. By saving the file and running a simulation, the rest of the values were derived. This whole process took only a few minutes compared to the lengthy amount of time it took to find the same values on the board.
Another, more complicated circuit was drawn on the board and we worked individually to draw the circuit on our computers. Some Sharpies had errors, but with the help of Mehd and Addy everyone eventually got the right drawing and values for their circuit. After another practice, we prepared our notes to take a 6 question quiz.
For the first section of the quiz, we used MATLAB to solve an equation, to draw and label a graph, and to write a program with conditionals. Sharpies printed out their graphs and program to hand in at the end of the quiz. For the PSPICE section, we drew and found the values of three different circuits. We wrote the missing values onto our quiz paper to hand in. Sharpies began finishing around 4:15 and some stayed later to complete their quiz. The introduction to MATLAB and PSPICE informed the Sharpies of the applications and procedures of the programming languages.
One graph that Sharpies drew
A sample MATLAB screen