Sie sind auf Seite 1von 17

ME 208 Introduction to Computing in

Engineering
Spring 2015

Welcome!!!

Introduction
A little about myself and the GTAs
Course Overview
Syllabus and Communication
Schedule
HW submission details

Course Overview
An introduction to programming methods
MATLAB, Labview

Emphasis placed on understanding


Logical problem solving using programming
Similarities between programming languages
The course also aims at making students to
Build strong team working skills
Improve soft skills

Syllabus and Communication


Please get help by going to office hours.
Email is a quick way to get help (sometimes the best way)

INTERNET!! But make sure you learn from reliable sources


ATTEND ALL LECTURES

HW Submission Details
HWs will be assigned every Friday at 1 pm.
They will be due the following Friday at 8.00 am.
Individual files HAVE TO follow the following format:
lastname_firstname_questionno
NO LATE HW SUBMISSIONS!
Please sign up for grading times with the GTAs.
You must always go to your grading at the time you signed up for.
If you do not go in person, you will NOT BE GRADED.

Programming Basics

Algorithm
Simple step-by-step procedure used for problem solving.
Order of some steps is important.

Written in simple language independent of any programming language.


Should not contain any specific syntax.
Think like a computer! You dont know what to do until you see a line of
code/algorithm.
Develop an algorithm and you will spend less time coding!!

Matlab vs Labview
MATLAB

LabVIEW

Matrix Laboratory

Laboratory Virtual Instrument


Engineering Workbench

Text based programming

Graphical programming (G programming)

Order of commands determines the


program flow

Position of block diagram doesnt


determine the program flow

Both of them are Programmable Application Software

Introduction to
MATLAB

The MATLAB Environment


Command Window
Workspace

Command history
Editor
Current directory and path

Docking and undocking

Variables in Matlab
A variable can be created by assigning a value to it.
The value defines the data type of the variable.

Syntax
variable = expression;

Eg:
>> x = 20; Hit enter
What happens when you type 20 = x; ?

Variable Nomenclature
Must start with a letter
Case sensitive (a is not the same as A)

Only the first 63 characters count


No spaces
You can use underscore

Using relevant names is a good way to code


Avoid reserved words.

Scratch Pad Command Window


Use the command window to do the following

>> 2*10
>> a = 2*10
>> a = 2*22 ;

>> b = a/10;
What happens if you want to do all of the above again?

Script File (*.m)


In order to run a batch or sequence of commands, we use a script file.
Script files can be run by typing the file name at the command prompt.
File name do not use reserved words or spaces.
Commenting is a good way to start your code in a script file. (comments
are not executed)

Arrays
One dimensional: x = [1 3 -1]
1 2 7
2 6 9
Scalar: array with 1 row and 1 column z = 5
Matrix: Two or more dimensions y =
String: an array of characters
Rockchalk Jayhawk

Array Operation
Addition +
Subtraction -

Multiplication *
Division /
Element-wise operations .*

./

.^

Order of operations is important : PEMDAS

Announcements
Make sure you can login in computers with your user id.
Gain access to ME computer lab. If not please go to the ME office room
and get help.
Make sure you can access Blackboard via http://courseware.ku.edu

You should see two links: one for the project and the other for ME 208
SIGN FOR YOUR HW GRADING. Link available on Blackboard
announcements.

Do the Lab exercise and submit it on Blackboard before you leave.


If you continue to have problems please email Nivi.

Das könnte Ihnen auch gefallen