Scientific Calculator for MATLAB



EENG 1920 Fall 2011Scientific Calculator for MATLABMichael Hunter, Shawn Thompson, and Michael JamesAbstractDesign a layout for and program a scientific calculator using MATLAB’s GUIDE (Graphic User Interface Design Environment). The calculator should include basic functions as well as advanced functions. We designed an easy to use calculator using programming techniques from class.IntroductionThe purpose of the project was to design a scientific calculator using MATLAB GUIDE. The calculator includes many functions common to other scientific calculators such as sine, cosine, and tangent functions. The calculator layout was straightforward, while the programming took a bit more thought. ResultsThe calculator layout took very little time to set up. The GUI (Graphic User Interface) was a simple drag-and-drop method. The objects, once laid out in the editor, could be moved around, resized, and manipulated rather easily. Once the layout was established, we saved the figure and MATLAB automatically generated the accompanying “m-file” containing the general program code. MATLAB set up the functions and all we needed to do was program each button. Some functions were easy to program. Functions like the pi input button and single input functions such as the ln (natural logarithm) button or the trigonometric functions. Other buttons and their functions were quite difficult to program. The button that gave us the biggest problem was the decimal point button. We initially had to settle for a decimal that shifted to the left through the number. The next problem was that once we had it append the string properly, you could add multiple decimal places (see Fig.1 Multiple Decimals below). Fig. 1: Multiple DecimalsEventually, we inserted conditional statements to evaluate if there was already a decimal point and ignore the additional attempts to insert another decimal. After the code had been added in the “m-file,” we went into debugging the full program. During debugging we had frequent errors, but MATLAB’s editor helped correct some of these. Correcting these errors helped us learn new functions and commands. Other errors, such as logic errors, required us to look over the function in question to see what was going wrong. We used the set and get commands to pull the variables into the individual functions and assigned them to variables. Assigning the values to variables made the calculations easier to manipulate. We kept the algorithms as simple as possible.ConclusionThe GUIDE in MATLAB allows users to create GUI’s quickly and efficiently. The GUI for the GUIDE is simple, but allows for a great deal of customization that allows for an effective scientific calculator to be created. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download