Unitconverterapp Report PDF

Title Unitconverterapp Report
Author MOVIE MANIAC
Course Digital Fundamentals
Institution Royal Melbourne Institute of Technology
Pages 9
File Size 541.5 KB
File Type PDF
Total Downloads 12
Total Views 140

Summary

Matlab report...


Description

RMIT University School of Engineering OENG1206 – Digital Fundamentals Individual Project Milestone 2 Lecturer: Dr. Kat r i naNev i l l e Student Name: Simon Manoj Student Number: S3814704 Lectorial Session: Thursday 15:30 to 17:30 Submission Due Date:

UNIT CONVERSION MATLAB PROGRAM REPORT OVERVIEW The goal of this program is to convert the units of mass, length, distance, and temperature according to the user’s need. To engender this program, one should ken the rudimentary Matlab syntax function for input and output a value. The syntax are input(), disp() and fprintf(). Along with this function, one needs to ken the mathematical expression for conversion, both imperial and metric expression, logical, arithmetic operator, and the syntax for the conditional statements. Supplementally, I utilize % to provide comments in the script. Moreover, one need to know, how to open an appdesigner in Matlab and how to integrate code in different component’s sections. Apart from these, I used user defined functions for calling different conversions. The main requirements for this project are as follows:   

Design and implement a unit converter that requests input from a user on which unit type, direction (imperial to/from metric) and value they want to convert. Your program must now be in the form of a graphical user interface (GUI)designed using App Designer (not GUIDE). Your conversions should also be performed in separate user-defined functions.

Since my last report, I added new functions in this program. The first and the main one is user defined function. I added four user defined functions in the program. In addition to use, I used Matlab’s appdesigner to make this program. Now the program works like an application under Matlab interface. I added a dropdown list to show the type of unit conversion available. Once the user selects an option in the dropdown list, the second dropdown list shows the direction and the available conversion. There is blank field where the user can enter a numerical value, and another filed the converted values are shown. There is also a message box which is hidden and shows message only when the user makes a mistake. In

addition to this, I added a concert button which converts the value the user enters.

My project can convert the unit of mass, distance, and length to other units of mass, distance, and length precisely. Moreover, it is user friendly and convenient. Surprisingly, it would not allow the user to enter a wrong value, which makes the program efficient. This program displays the menu of unit conversion available and the user selects the desired program. Due to the above reasons this program will work without an error and gives the user the exact precise value.

TESTING AND ANALYSIS At the first drafted script, the program crash continuously it is because the program did not send the input arguments to the external functions. Later I understood that it is difficult to send a string as an input argument to an external function. I fixed that error by substituting each string with number which I used as an input argument. Thus, I solved the problem of the external function. After fixing the problem with the functions, I faced the problem of empty selection in the unit type. To be more precise, when the program begins, and the user press convert button without selecting any unit type the program crashes. Later, I solved that problem with conditional statements and with the help of showing an error message. The next error that I faced during the testing face is that, once the user makes a mistake, the error message displayed but the user fixes his part of the mistake, the error still shows. I fixed that error by adding the error message in conditional statements and I also add blank space as error message if the user did not commit an error. Thus, I able to display the error messages properly

The outcome of my program is more than what I expected. I tried inputting several values to ensure it converts the values precisely. Surprisingly, every converted value is accurate, and I verified it myself. Additionally, I reduced the decimal places to two positions so the user who uses my program could easily write the values without rounding off the values. Interestingly, if the user leaves the input blank the program by default add the number zero. Similarly, if the user enters a character or string instead of numeric data, then the program will display some error commands by default. The table below shows my testing output. The testing is done with the help of a google calculator. The converted values are tested in the chrome google calculator. The values obtained from the google calculator are the same as the values received from the program. The testing table is given below:

The error testing screen shots are given below:

In here, if the user press convert button without selecting the unit type, an error message

In here, if the user enters a negative value for the unit types except for temperature an error message shows along with a message ‘enter a positive number’.

Type

Input Value

Output Value

Verified Answer

0 100 32 -40 55 0 17.77 128

-17.78 37.78 0.00 -40.00 12.78 32 63.99 262.40

-17.78 37.78 0 -40 12.78 32 63.99 262.40

10 45.69 1510 15 156 54.65 54 12.5 98.2 15.23 521.9 99.99 84.56 100 1 62 20.20 6.3

3.94 17.99 594.49 38.10 396.24 138.81 177.17 41.01 322.18 4.64 159.08 30.48 52.54 62.14 0.62 99.78 32.51 10.14

3.94 17.99 594.49 38.10 396.24 138.81 177.17 41.0 322.18 4.64 159.08 30.48 52.54 62.14 0.62 99.78 32.51 10.14

33.33 369.36 999 6 10 111.11 1 32

1.18 13.03 35.24 170.10 283.50 3149.91 2.20 70.55

1.18 13.03 35.24 170.10 283.50 3149.91 2.20 70.55

123

271.16

271.16

Temperature o

F→ C

o

o

C→ F

o

Length & Distance cm → inch

inch → cm

m → feet

feet → m

km → miles

miles → km

Mass grams →ounces

ounces → grams

kg → pounds

SOURCE: GOOGLE CALCULATOR

Given below are the screenshots the interfaces.

This is the design view in the appdesigner. In here, one can design the app, that is the visual part of the app. The left part is the available components such as button, label etc. The right part is the component browser where one can interact with the components. In the centre or the main part is the GUI part where one can add the components.

This is the code view part where the codes are added. There is separate sections for each component that are added in the design part where the codes are added .

This is the app interface. In this app interface, there are 7 components are present. Two labels (one hidden and shows only when error occurs), two dropdown list boxes, two edit fields and a button are the components.

This is an example of function interface in matlab.

CONCLUSION To conclude, my program can convert the units of length, distance, and mass into other units of length, distance, and mass. The values are accurate, and the user interface is simple. The comments that I add to the script will help others to understand the codes easily. The testing of the codes went smoothly without any error. This program will not allow the user to input the wrong value and always give the correct value. The program works great....


Similar Free PDFs