0% found this document useful (0 votes)
45 views8 pages

Liu11 3

This document introduces a programming course for second-year mechanical engineering students that teaches both C# and MATLAB. The course aims to provide students with tools to develop software and GUIs to solve engineering problems. C# and MATLAB were chosen as they are commonly used programming languages in engineering that allow students to more easily solve problems. The document outlines topics covered in the course, the schedule, and evaluation methods. Feedback indicated the course objectives were met and supported broader program goals.

Uploaded by

hfalaniz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views8 pages

Liu11 3

This document introduces a programming course for second-year mechanical engineering students that teaches both C# and MATLAB. The course aims to provide students with tools to develop software and GUIs to solve engineering problems. C# and MATLAB were chosen as they are commonly used programming languages in engineering that allow students to more easily solve problems. The document outlines topics covered in the course, the schedule, and evaluation methods. Feedback indicated the course objectives were met and supported broader program goals.

Uploaded by

hfalaniz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/262564402

A programming course including C# and MATLAB for mechanical engineering


students

Article in Computers in Education Journal · July 2011

CITATIONS READS

8 2,438

1 author:

Yucheng Liu
South Dakota State University
250 PUBLICATIONS 1,868 CITATIONS

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Mechanical Systems Design View project

Alternative Energy View project

All content following this page was uploaded by Yucheng Liu on 24 May 2014.

The user has requested enhancement of the downloaded file.


A PROGRAMMING COURSE INCLUDING C# AND MATLAB
FOR MECHANICAL ENGINEERING STUDENTS
Yucheng Liu
Department of Mechanical Engineering
University of Louisiana at Lafayette

Abstract and MATLAB to solve engineering problems.


Such course is designed for the second year
This paper introduces a programming course mechanical engineering students.
which provides second year mechanical
engineering students the opportunity to develop As powerful programming tools, C# and
engineering-oriented software and Graphical User MATLAB have been taught and used in
Interface (GUI) using the principles of software engineering courses at different universities [1].
engineering. Two object-oriented languages, C# Bernhart et al [2] and Christensen [3] discussed
and MATLAB) were taught in this course to make the explicit demand and benefits of adding a
the students familiar with different types of course in the Microsoft.NET platform and the C#
programming languages. Methods used in in mechanical engineering department. Nolan et al
teaching this course such as topics, [4] developed a program in C# to measure the
class/laboratory schedule, and evaluation surface texture using fractal dimension. This
instruments are explained. The course objectives program was then revised as a case study and used
were well met according to the student learning for a civil engineering course. Conventionally, C#
outcomes and several Mechanical Engineering was considered too professional and only taught in
B.Sc. program objectives were also supported by computer science and computer engineering
this course. This course was taught by the author department. Recently, other engineering
at University of Louisville and will be offered in departments have added C# as an educational
University of Louisiana at Lafayette. programming language in their curricula because
of its simplicity, safety, and high performances in
Introduction engineering applications.

Computer software and programming techniques Compared to C#, MATLAB is a much more
have been widely applied for solving engineering popular software package that has long been used
problems and therefore become more critical in in engineering courses. Kim et al [5] showed
engineering education. For that reason, courses in advantages of using MATLAB in teaching linear
programming with a high-level language (such as algebra to engineering students. The authors
FORTRAN, Pascal, C, or C++) have long been developed web-based engineering numerical
included in many first and second year software using MATLAB and its web server tool
engineering curricula. Such courses have box in order to provide basic solution tools in
traditionally been justified as teaching logical linear algebra, including eigenvalue problems. It
thinking and problem solving, while providing the was proved that the developed software is very
students with tools that they will use as practicing helpful for applied mathematics education. Wirth
engineers. However, these goals can be achieved and Kovesi [6] explored the use of MATLAB for
more readily through the use of object-oriented teaching the fundamental constructs of
programming languages such as C# and modern programming languages to engineering and
mathematical software tools such as MATLAB. science students. It was found by the authors that
Such languages and tools are more powerful and the time taken for students to learn programming
easier to master than a traditional programming can be reduced by up to 50% because of
language, allowing students to solve engineering MATLAB’s simpler syntax. Vondrich and
problems more easily and efficiently. This paper Thondel [7] illustrated the use of MATLAB in
introduces a programming course, Structured engineering education through practical example
Programming, which teaches students using C# and concluded that MATLAB appeared to be the
106 COMPUTERS IN EDUCATION JOURNAL
most successful for teaching compared to other
possible software products. Yaz and Azemi [8],
and Cao and Wu [9] described the benefits of
using MATLAB in electrical engineering courses
in enhancing students’ understanding of materials
and reducing their amount of time spent in
performing computational homework assignments.
Also, the methodology of integrating MATLAB
into mechanical engineering curricula to improve
the quality of mechanical engineering education is
presented and discussed by Habib [10].
Figure 1. Object-oriented program structure.
Because of their strengths, a programming
course was designed, which aims to teach the component architecture and it provides an easy
second year mechanical engineering students how and efficient way to create window applications.
to use C# and MATLAB in one semester. Therefore, it is important for mechanical
Meanwhile, the students can obtain critical engineering faculties to teach C# and .NET to the
programming skills and general computational students to prepare them well for this challenging
knowledge through this course, which is not well era and allow them to become successful
covered in traditional curricula. Compared to mechanical engineers.
similar courses taught in other universities, this
course is more efficient and focused: it removes MATLAB is a special-purpose computer
all the materials which are too profound for non- program optimized to perform engineering and
computer science students and only focuses on scientific calculations. As another object-oriented
using both languages to solve real world programming language, MATLAB is different
mechanical engineering problems. from C# because it is an interpreted language.
There are two major ways to implement a
C# and MATLAB programming language: interpretation and
compilation. C# is a compiled language, whose
Both C# and MATLAB are object-oriented implementation is typically compliers (translators
language. Since 1990’s, object-oriented which generate machine code from source code).
programming (OOP) has become the prevalent However, the implementation of an interpreted
technique used for developing software tools and language often takes the form of an interpreter,
interfaces. OOP is based on the notion that which is a step-by-step executor of source code,
software packages can be viewed as consisting of where no translation takes place. Because of that
distinct objects with properties that can be reason, MATLAB execute more slowly than C#
manipulated by methods [11]. Compared to and is more expensive. Despite its defects,
traditional programming techniques, OOP offers MATLAB offers a lot of advantages: it is easy to
unique virtues such as encapsulation and use and is supported on many different computer
inheritance, which make the software easy to systems; it has an extensive library of more than
maintenance and make the programming language 1000 predefined functions plus many special-
easy to learn. Because of these advantages, many purpose toolboxes; the plots and images generated
modern programming languages now support from MATLAB can be displayed on any graphical
OOP. A paradigm of OOP is shown in Figure 1. output device supported by computer. These
advantages make MATLAB very suitable for
C# is a simple, general-purpose, OOP language mechanical engineering applications. We teach
developed by Microsoft and supported by both C# and MATLAB in Structured
the .NET Framework’s Common Language Programming course so that our students can have
Runtime (CLR) [12]. As stated by experiences in using and dealing with two typical
Microsoft, .NET will replace COM as a software languages that represent different implementation
schemes.
COMPUTERS IN EDUCATION JOURNAL 107
Approach and Methodology • An ability to identify, formulate and solve
problems in the field of mechanical
It is important to understand that this course was engineering.
designed for students who want to learn • A recognition of the need for, and an ability to
computational knowledge and programming engage in, life-long learning in the field of
techniques, and pursue a career in mechanical mechanical engineering.
engineering. This course was designed to be taken • An ability to use the techniques, skills, and
by students at the sophomore level or above and modern tools necessary for the practice of
provides them with (1) an introduction to mechanical engineering.
engineering software development using an
object-oriented programming language (C#) Text Book
within a modern develop environment
(Microsoft.NET), and (2) instruction in the use of • J. Liberty, B. MacDonald, Learning C# 2005:
high-level numerical computing environment and Get Started with C# 2.0 and .NET
programming language (MATLAB) for programming, 2nd edition, O’Reilly.
engineering applications. • S. Chapman, MATLAB Programming for
Engineers, 3rd edition, Thomson.
This course has a well defined schedule and
syllabus so that the instructor would cover the Organization
various sections of the class, which was required
by the breadth of material and subject matter. Three 50 minute sessions per week devoted to
Visual and hands on learning techniques were lecture/discussion and problem solving. The
used wherever possible by the instructor of this difficulty of this course is such that a minimum
course. In many regards, the mechanical weekly commitment of 8-10 outside study hours
engineering students who took this course have will be required.
different background in computational and
software knowledge. To help in this regards, Grading
instructor was available for one-on-one office time Homework 20%
with students. Students were able to use class time Quiz 10%
and available office hours to discuss on special Midterm Exam 10%
topics with the instructor. Descriptions of a course Final Exam 10%
syllabus are presented. C# Project 20%
MATLAB Project 20%
Course Syllabus Professionalism 10%
Total 100%
Structured Programming
Final grades will be calculated according to an
Course Learning Objectives absolute scale:

≤ 59 F
The Mechanical Engineering Department has a
60-62 D- 63-67 = D 68-69 D+
set of five primary program objectives and 11
70-72 C- 73-77 = C 78-79 C+
educational outcomes associated with the
80-82 B- 83-87 = B 88-89 B+
B.Sc./M.Eng. curriculum. Structured
90-92 A- 93-97 = A 98-100 A+
programming supports the program objectives by
developing: Topic/Activity
• An ability to apply knowledge of mathematics, Week 1: Introduction (computer programming
science, and engineering in the field of languages, C# and .NET software
mechanical engineering. development platform); C#
fundamentals (types, constants).

108 COMPUTERS IN EDUCATION JOURNAL


Week 2: C# fundamentals (variables, Project 1 – C#
expressions); variable types and arrays.
Week 3: Flow control (Boolean logic, Assignment:
branching, looping).
Week 4: Functions, OOP fundamentals (classes, Using C# to design an online checking account.
objects). After log into this account, user can perform
Week 5: OOP fundamentals (properties, fields, following operations: add deposit, withdraw cash,
methods, inheritance). transfer balance, view current balance, and view
Week 6: OOP fundamentals (polymorphism, the history statement. The final program should be
events); Window application (window able to handle all kinds of exceptions; an account
forms collection). number and password have to be set for this
Week 7: Window applications (input and account.
output).
Week 8: Window applications (graphics with Deliverables:
GDI+).
1. Project report – briefly describe the project
Week 9: Window applications (C# .NET
problem and explain how the program is
project).
designed; list all the classes and forms used in
Week 10: Introduction to MATLAB.
the C# program. (15 pts).
Week 11: Arrays.
2. Help documents – show users how to use the
Week 12: Modular program (functions and script
online checking account; use screen shots of
files).
different interfaces to explain the functions of
Week 13: Input and output; Control structures
different buttons and controls. (15 pts).
(decisions, loops, and vectorization).
3. An oral presentation needs to be given to show
Week 14: Data types (cell arrays and structures);
that the final program meets all the design
MATLAB project.
requirements and is safe enough to handle
Week 15: MATLAB graphical user interface
wrong operations. (70 pts).
(GUI).

Design Projects

Two exams were given in this course, one for C#


and one for MATLAB. However, both exams only
included problem solving and answering,
computer operations and programming were not
covered in the exams. In compensation, two
course projects were assigned to each student,
which were major components in this class. The
two projects mirrored typical design projects
Figure 2. A vehicle-suspension-wheel system.
found in industry. It is believed that students will
not be able to develop their engineering software
Project 2 – MATLAB
development techniques and a complete
understanding of computational application in
Assignments:
mechanical engineering without two projects that
focus on C# and MATLAB, respectively. Two
Fig. 2 shows a vehicle system that will be used
examples of the course design projects are
for rigid body analysis. Neglecting the damping
presented below, where the C# project focuses on
effects, the governing equation of such system is
engineering software development and the
MATLAB project focuses on mechanical
engineering problem formulation and solution. [M V ]X + [ K V ] X =0 (1)

COMPUTERS IN EDUCATION JOURNAL 109


In Eqn. (1), X is the displacement vector of the
vehicle system; MV is the mass matrix, which is
defined by:

where KV is the stiffness matrix defined as:

Select proper values (with units) for all the frequencies and eigenvectors found using
parameters and construct matrices [Mv] and [Kv]; MATLAB). (40 pts).
based on the matrices, find natural frequencies for 2. A table to list the sorted natural frequencies.
this vehicle system (the number of natural (15 pts).
frequencies should equal to the rank of the 3. A plot for the natural frequencies. (15 pts).
matrices); list natural frequencies in a table from 4. Solve the eigen problem to find all normalized
low to high; plot these frequencies in a 2-D plot eigenvectors. (15 pts).
(vs. mode index); each natural frequency is 5. A plot for a normalized eigenvector with a
accompanied with an eigenvector, which is an specified mode. (15 pts).
animation mode of the vehicle system, resort these
eigenvectors according to the resorted natural Student Assessment
frequencies; create a function to normalize an
eigenvector based on a input mode index number This course was taught by the author to the
and plot at least one normalized eigenvector with mechanical engineering sophomore at University
a specified mode; save all functions into M-files. of Louisville in Fall of 2007. As an entry-level
programming course, Structured Programming
Deliverables: effectively developed the students the
programming skills and capabilities of solving
1. Project report (briefly describe the project complex engineering problems using popular
problem, include the figure of vehicle engineering and mathematics software package.
assembly, list all selected values and write out 24 students enrolled in this class and by the end of
the matrices, list all the M-files and functions that semester, favorable outcomes were received
generated for this project, attach all the natural from the student feedback as well as from the
course evaluation. From the evaluation results

110 COMPUTERS IN EDUCATION JOURNAL


(Table 1), it was reflected that this course was Results and Conclusions
well designed that the students had learned
fundamental knowledge of computer language and Because of the increasing significance of
programming, developed basic skills to develop software knowledge and programming techniques
engineering-oriented software and graphic user in mechanical engineering, a Structured
interfaces using the principles of software Programming course was designed for the second
engineering, and matured in the use of a suitable year mechanical engineering students. The course
programming language such as MATLAB. syllabus which includes the learning objectives
required course textbooks, grading breakdown of
Student feedback was also exciting, from which the course, and covered topics are presented in
it showed that the students had benefited from this this paper.
class. Selected comments from the students
include: This course includes hands on and visual lessons
to better help students to learn the two different
“Amount of knowledge gained was tremendous. programming languages, C# and MATLAB.
This class will be very helpful in my career.” Different evaluation tools such as homework, quiz,
exams, and design projects are used to help
“This is one of the toughest classes, but Dr. Liu students to grasp the concepts being taught. It is
is extremely effective at communicating difficult believed that the best way to solidify the main
concepts in the classroom.” ideas of this course is the design projects which
develop students’ ability to use C# to develop
“The class was well organized as always. Dr. Liu engineering software and use MATLAB to
presents a caring, considerate and open attitude formulate and solve a mechanical engineering
toward the students.” problem. Oral and written communication skills
are also required in both exams. A project
“I have learned a lot from this class and the overview and description can also be found in text.
instructor has earned my respect!”
This cause has been taught by the author in
With the success of offering Structured Mechanical Engineering Department at University
Programming in University of Louisville, the of Louisville. The course objectives were well met
same class is planned be implemented into according to the student learning outcomes and an
Mechanical Engineering curriculum at University assessment from students also ascertained their
of Louisiana at Lafayette in the near future. interests in this course. Such course is thereby
ready to be added into current curricula of
Mechanical Engineering Department at University
of Louisiana at Lafayette after small modifications.

Table 1. Selected course evaluation reports.

Query Strongly Agree Undecided Disagree Strongly


agree disagree
I learned a lot in this course 20 (84%) 4 (16%) 0 0 0
This course challenged me to think 16 (67%) 8 (33%) 0 0 0
Summary Excellent Good Average Fair Poor
Overall, I would rate this course as 20 (84%) 4 (16%) 0 0 0
Overall, I would rate the effective- 20 (84%) 4 (16%) 0 0 0
ness of this instructor as

COMPUTERS IN EDUCATION JOURNAL 111


References 8. E. E. Yaz, A. Azemi, “Utilizing MATLAB
in two graduate electrical engineering
1. A. Pyster, R. Turner, D. Henry, K. Lasfer, courses”, Proceedings of the Frontiers in
L. Bernstein, K. Baldwin, “Current state Education Conference on 1995, 1(1-4),
of software engineering masters degree 1995, pp. 2c6.1-2c6.4.
programs”, Proceedings of the 21st
Conference on Software Engineering 9. Y.-J. Cao, Q.-H. Wu, “Teaching genetic
Education and Training, Charleston, SC, algorithm using MATLAB”, International
USA, April 14-17, 2008, pp. 103-109. Journal of Electrical Engineering
Education, 36, pp. 139-153.
2. M. Bernhart, T. Grechenig, J. Hetzl, W.
Zuser, “Dimensions of software 10. M. S. Habib, “Enhancing mechanical
engineering course design”, Proceedings engineering deep learning approach by
of the 28th International Conference on integrating MATLAB/Simulink”,
Software Engineering, Shanghai, China, International Journal of Engineering
May 20-28, 2006, pp. 667-672. Education, 21(5), 2005, pp. 906-914.

3. J. E. Christensen, K. Ribu, “A method for 11. J. Mackerle, “Object-oriented program-


learning software tools in engineering ming in FEM and BEM: a bibliography
education”, Proceedings of the 9th (1990-2003)”, Advances in Engineering
International Conference on Engineering Software, 35, 2004, pp. 325-336.
Education, San Juan, PR, July 23-28, 2006.
12. J. Bishop, N. Horspool, “C# concisely”,
4. J. M. Nolan, F. N. Kremm, D. Budny, Pearson Education Ltd. 2004.
“Advances in on demand programming
solutions developed in C# by non Biographical Information
computer science majors”, Proceedings of
the 9th International Conference on Dr. Yucheng Liu is an Assistant Professor in the
Engineering Education, San Juan, PR, Department of Mechanical Engineering,
July 23-28, 2006. University of Louisiana. He received his Ph.D. in
mechanical engineering from the University of
5. A. S. Kim, C. Park, S.-H. Park, Louisville in 2005 and has research and teaching
“Development of web-based engineering experience in the areas of programming and
numerical software (WENS) using development of interactive software, mechanical
MATLAB: applications to linear algebra”, and machine design, computer modeling and
Computer Applications in Engineering simulation, structural mechanics, finite element
Education, 11(2), 2003, pp. 67-74. analysis, crashworthiness analysis, vehicle system
design and analysis, applied mathematics, etc. To
6. M. A. Wirth, P. Kovesi, “MATLAB as an date, he has authored more than 70 publications in
introductory programming language”, his research areas and has been the PI or Co-PI on
Computer Applications in Engineering over $1.5 millions of research funds. He is an
Education, 14(1), 2006, pp. 20-30. editorial board member of an international journal
and also has served as reviewer for 18 refereed
7. J. Vondrich, E. Thondel, “The application journals and 5 international conferences. Dr. Liu
of MATLAB in engineering education”, is a professional engineer registered in Ohio, and
Proceedings of 2003 International holds memberships in ASME, SAE and ASEE.
Conference on Simulation and Multimedia
in Engineering Education, Orlando, FL,
USA, January 19-23, 2003.

112 COMPUTERS IN EDUCATION JOURNAL

View publication stats

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy