Matlab Project

profiles3eeewd
me20102020final20project20spring202016.pdf

1

ME 1020 FINAL PROJECT SPRING 2016 Due Date: The project must be submitted to Pilot by noon on 22 April for all students! NO LATE WORK

WILL BE ACCEPTED!

PURPOSE The purpose of the final project is to help the student learn to plan, construct, test, document, and present a

final project for use in future applications. The project intent is to assist a student in learning to combine

multiple technical skills into one task solution set.

I will provide samples of previously produced student GUI programs. Please understand, you are to create

YOUR OWN versions of these and not merely copy these samples.

PROGRAM COMMENTS

You are expected to use the best possible programming methods for this project. This means, we expect you to

employ loops, conditional logic, minimal code sets, testing, error checking, and other acceptable coding methods

for this project. Using ‘brute force’ coding techniques will reduce your project grade!

You are expected to submit both TUI-based and GUI-based solutions for this project. This means, you

will make a Start Screen with five TUI solutions and a different Start screen with GUI versions of most of

the solutions.

TASK OVERVIEW Each student will plan, develop, produce, and be ready to demonstrate, upon request, five separate Matlab

TUI-based programs and five separate Matlab GUI-based programs. The problems for this project are:

1. Vector Decomposition Program - with Graphing and Data Export to Excel 2. Calculus Program – Integration & Differentiation of input expressions. 3. Projectile Motion Program – Permit users to input initial condition values and produce both

graphical and textual results.

4. Matrix Solver Program – Permit users to select 2 x 2, 3 x 3, or 4 x 4 matrix and solve. 5. Statics Solver for 3-D Vector – Permit selected input and output. 6. Start Screens – Each student must create a Start Screen for their TUI-programs and a different Start

Screen for their GUI-programs.

7. Project Report – The report requirements are posted at the end of this document.

Below is one example of a Start Screen. It might not be the same type you create. Be innovative in your solution. You are to create your own versions of Start Screens for the project.

The Task 1 button activates the program to perform all required operations for ‘Task 1’ of this project. The Task 2

button activates the program to perform all required operations for ‘Task 2’ of this project and so forth. When a

task is selected, this menu should ‘disappear’ and not be visible. When you complete a task, this menu

should reappear!

2

Task 1 – Vector Decomposition Program. Each student is to plan, develop, construct, test, and document all efforts to write a program to compute the x-components, y-components, sum-of-x-components, sum-of-y-

components, the resultant vector, and the angle associated with the resultant of up to ten different 2-

dimensional vectors. Then, plot all ten vectors and the resultant using different colors and line types on the

same figure file. You must include a grid, vertical and horizontal axes labels, a title, legend, and appropriate

axis controls on your graph. Also, you must have the ability to permit the user to export all input and output

data to an Excel file called “FnlTsk1.xlsx”. Hint: This is similar to the vector decomposition programs we

discussed and planned in many lectures this term. You have received 98% of all information needed for this

task to date! The rest is up to your independent research. Remember, you are to develop BOTH a TUI and a

GUI-based solution for this task. Two samples are shown for your benefit.

These are the main screen for the sample vector decomposition programs. Note the pushbuttons activate other

figure files for data input, plotting, and other functions.

3

Task 2 – Calculus Program. Each student is to plan, develop, construct, test, and document all efforts to develop a TUI-based solution and a GUI-based program to permit users to input up to three different

mathematical expressions (try polynomial first) and have the program compute the first, second, and third

derivatives of each input expression. Next, have the program compute the ‘anti-derivative’ of the input

expressions. Hint: You may use either standard model or symbolic mode data. Output should be discerned

easily from the input data. You must export the input and output data to a text file called “FnlTsk2.txt”.

Employ the ‘simplified version’ of the expression and the ‘pretty’ version of the expressions as well! Two

sample GUI images are provided below.

4

Task 3 – Projectile Motion Program. Each student is to plan, develop, construct, test, and document all efforts to write a program to permit a user to compute ANY of the following information based on user selection:

The TRAJECTORY, maximum altitude, speed, and total distance a projectile will travel, if launched at a

user selected input angle and velocity (used in ballistic missile computations). Include a plot of the final

computed trajectory on the same form. YOU need to figure out what the input parameters to your program

should be to obtain the information we expect for this program! Hint: You will need to use the axes control on

your form for this task. Two samples are provided below. Remember, you are to develop both TUI-based and GUI-based solutions! No data will be exported to files for this task.

Sample code (may or may not be useful)

flightTime=2*velocity*sind(angle)/9.8;

maxRange = velocity * cosd(angle) * flightTime;

maxHeight = maxRange * tand(angle) / 4;

5

Task 4 – Matrix Solver Program. For this task, you are to develop a program to permit a user to choose to

solve either a 2 x 2 matrix, a 3 x 3 matrix, or a 4 x 4 matrix developed from either a STATICS or

CIRCUIT ANALYSIS type of problem. Then, your program is to permit a user to enter the coefficients

of the equations into the program and compute the ‘solutions’ to the unknown equations. Your program

should export ALL results to a Microsoft Excel file called “Fnltsk4.xlsx” (for both the GUI and the

TUI programs!) For example, you might be given the set of equations below representing the currents in

different loops of an electronic circuit and your program will be used to find the current in each ‘loop’ of

the circuit. Samples will be presented in class lectures. Please be prepared to take your own notes.

Task 5 – This program is intended to help you in your future engineering mechanics courses. Use the figure below. Develop only a TUI-based Matlab program to permit a user to enter ANY coordinate set of

the points identified on this image shown below. This is the exact same problem from Quiz 3 this term.

You are provided the basic information about a transmission tower you are to analyze. A transmission

tower is held by three guy wires anchored by bolts at B, C, and D. Point O is determined to be the origin

of this system. The lengths of the cables (1, 2, 3, 4, 5, 6, and 7) can be obtained by importing a table of

data from a file. Also, the tensions in cable AB, AC, and AD can be obtained from this file. Perform the

tasks listed below for this problem.

TASKS:

A. Import the data in the file called “ME1020QZ3Prob2.xlsx” into your solution file. Store this in a variable

called “myDATA”.

B. Hint: After importing the data, you should delete rows 1 (with the text headers), 2, and 3.

C. Include the necessary code in your program to ensure you have at least 10 rows and 7 columns of actual

data.

D. Include code to ensure your first usable set of data has a value of Tension in cable AD = 315 lbs and AC =

0, and AB = 0. You need to write code to do this.

E. You will need to determine what values are important to this problem and what are not.

F. Write the code to obtain the information need to compute the distance from point A to point D. Call this

variable AD.

G. Write the code to compute the magnitude of this distance. Call this variable ADMAG.

H. Write the code to compute the cosine vector, λ, for AD and ADMAG. [Round this cosine vector to 4 places

to the right of the decimal point.]

I. Write the code to compute the components of tension (force) for the cable AD.

J. Write the code to display your results in a structured format. A sample of the expected output is given

below. Write the code to send your data to a new Microsoft Excel file called “OUTPUT2.XLSX”.

K. ALL data is to be exported to a single file.

6

L. Write the code to permit execution of your program until you find a Tension value for cable AB, AC, and

AD equal to 500 pounds of force!

Sample OUTPUT2.XLSX Contents Example

Samples of some of these programs will be demonstrated or discussed during classes. Independent

research must be performed to find other examples.

GRADING Task 1, Task 2, and Task 3 are worth 20 points each. Task 4 and 5 are worth 10 points each. The Start Screens are

worth 10 points in total. Your project report is worth 10 points towards the project.

Your documentation and project submissions for the five programs are worth 10% of the final course grade.

INSTRUCTIONS AND WHAT TO SUBMIT FOR GRADING 1. Complete each task listed above.

2. Perform sufficient testing on each program to ensure they work as expected.

3. Write one comprehensive technical report, not less than ten pages, explaining your design, construction, testing

methods, and results for each program using the engineering report format below. As part of this report, include a

short ‘user’s guide’ for each program you develop as part of your documentation. Include at least two different GUI

‘snap shots’ and label each control. Explain the function of each control as they pertain to your programs.

4. Expected report format:

a. Coversheet b. Introduction – explain the purpose of the project and what is contained in your report. c. Overview – Explain how you planned and developed the project d. Conceptual Design of Task One – show the plan, include data about what you accomplished, etc. e. Task One Completed Program – include image ‘snapshots’ of the completed form and code. f. User Guide for Task One g. Conceptual Design of Task Two h. Task Two Completed Program i. User Guide for Task Two j. Conceptual Design of Task Three k. Task Three Completed Program l. User Guide for Task Three m. Conceptual Design of Task Four n. Task Four Completed Program o. User Guide for Task Four p. Conceptual Design of Task Five q. Task Five Completed Program r. User Guide for Task Five s. Problems Encountered and Solutions t. Conclusions – what you learned from completing the project u. Appendices – initial sketches and layout work

7

5. Submit one compressed ZIP-file with all work for this project to the COURSE DROPBOX not later than the date

assigned for your particular final project. This means you put the report, all m-files and fig-files into one

compressed ZIP-file and post it to Pilot. No other compressed file is permitted. Grade reductions of up to 20% will

be assessed for failure to compress the data properly. If the instructor is not able to extract your files, execute the

programs, or read your report, he may send you an email to give you the chance to correct the problem. It is

important for you to check your email daily during final’s week.

6. Be creative. Extra credit may be assigned for creative solutions.

7. Focus on the ‘nuts & bolts’ of the program, but don’t overlook the importance of a user-friendly GUI.

8. Extra credit may be earned on this final project!

9. You may receive no assistance from anyone other than the course instructor for this project. Any

violations will be handled through the Office of Judicial Affairs.