General Computer Science for Engineers CISC 106 Lecture 03 James Atlas Computer and Information Sciences 6/15/2009.

Slides:



Advertisements
Similar presentations
Introduction to the Omega Server CSE Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger.
Advertisements

Linux, it's not Windows A short introduction to the sub-department's computer systems Gareth Thomas.
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
Dayu Zhang 9/8/2014 Lab02. Example of Commands pwd --- show your current directory This is home of venus, not your home directory Tilde: means you are.
CSCI 1411 FUNDAMENTALS OF COMPUTING LAB Lab Introduction 1 Shane Transue MSCS.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Working Environment - - Linux - -.
CS 202 Computer Science II Lab Fall 2009 August 27.
General Computer Science for Engineers CISC 106 Lecture 09 James Atlas Computer and Information Sciences 9/25/2009.
General Computer Science for Engineers CISC 106 Lecture 05 Dr. John Cavazos Computer and Information Sciences 2/20/2009.
FORTRAN.  Fortran or FORmula TRANslation was developed in the 1950's by IBM as an alternative to Assembly Language. First successfull high level language.
Virtual Machine and UNIX. What is a VM? VM stands for Virtual Machine. It is a software emulation of hardware. By using a VM, you can have the same hardware.
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
Understanding the Basics of Computational Informatics Summer School, Hungary, Szeged Methos L. Müller.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
GETTING STARTED USING LINUX UBUNTU FOR A MULTI-USER SYSTEM Team 4 Lab Coordinator Manager Presentation Prep Webmaster Document Prep Faculty Facilitator.
Learning basic Unix command IT 325 operating system.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
General Computer Science for Engineers CISC 106 Lecture 07 James Atlas Computer and Information Sciences 06/29/2009.
Computer Programming for Biologists Oct 30 th – Dec 11 th, 2014 Karsten Hokamp  Fill out.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
1 N305 C Programming. 2 Objectives for the Lab ä Learn problem solving strategies ä Achieve intermediate knowledge of C Programming Language ä Gain experience.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Usage of Workstation Lecturer: Yu-Hao( 陳郁豪 ) Date:
Next Unix Topics Tuesday, 2/11 & 18/2014. Change Password (by 2/14/14) ssh to account on – faclinux.cse.ohio-state.edu – stdlinux.cse.ohio-state.edu passwd.
CGS 3460 Why we choose UNIX n Powerful lMulti-user operating system lGood programming tools Most heavy-duty database management systems started out on.
Introduction To UNIX. FAQReferencesSummaryInfo Resources Introduction Learning Objectives Log on User Interface Commands List of Commands Useful Info.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
COP3502: Introduction to Computer Science Yashas Shankar Lecture #2.
General Computer Science for Engineers CISC 106 Lecture 03 James Atlas Computer and Information Sciences 2/17/2010.
More on Using onyx 8/28/13. Program 1 Due a week from today. See website for details.
General Computer Science for Engineers CISC 106 Lecture 13 - Midterm Review James Atlas Computer and Information Sciences 10/02/2009.
General Computer Science for Engineers CISC 106 Lecture 15 Dr. John Cavazos Computer and Information Sciences 03/16/2009.
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Lecture 2 Debugging,
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
General Computer Science for Engineers CISC 106 Lecture 14 James Atlas Computer and Information Sciences 08/10/2009.
The Unix File sytem. Introduction Tree structure …
CSE 1320 Basics Dr. Sajib Datta
Intro. To Unix commands For those who’ve never used Unix before Quick tutorial to let you move around your Unix Accounts No discussion of inner workings.
Learning basic Unix command It 325 operating system.
Dr. Sajib Datta Jan 16,  The website is up.  Course lectures will be uploaded there ◦ Check regularly for assignments and update.
General Computer Science for Engineers CISC 106 Lecture 02 James Atlas Computer and Information Sciences.
+ Introduction to Unix Joey Azofeifa Dowell Lab Short Read Class Day 2 (Slides inspired by David Knox)
Learning Unix/Linux Based on slides from: Eric Bishop.
Operating systems Lecture #3 Modern OS characteristics.
General Computer Science for Engineers CISC 106 Lecture 03 James Atlas Computer and Information Sciences 9/9/2009.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Tutorial Six Linux Basics CompSci Semester Two 2016.
Introduction to Unix for FreeSurfer Users
ENEE150 Discussion 01 Section 0101 Adam Wang.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
CS1010: Intro Workshop.
Getting started with CentOS Linux
UNIX The Basics Source:
Andy Wang Object Oriented Programming in C++ COP 3330
Matlab Training Session 4: Control, Flow and Functions
Unix Shells.
Getting started with CentOS Linux
Andy Wang Object Oriented Programming in C++ COP 3330
Tutorial Unix Command & Makefile CIS 5027
CSE 303 Concepts and Tools for Software Development
Lab 2: Terminal Basics.
Presentation transcript:

General Computer Science for Engineers CISC 106 Lecture 03 James Atlas Computer and Information Sciences 6/15/2009

Lecture Overview Review Using Matlab remotely Conditions ◦ If statement Loops ◦ For loops

Review Computer Science ◦ Data ◦ Operations Matlab functions

Emacs To start emacs ◦ emacs Graphical version ◦ emacs –nw Text version To open a file ◦ emacs ◦ emacs … then Ctrl-x Ctrl-f ◦ Menu: File then “Open File…” To save file ◦ Ctrl-x Ctrl-s ◦ Menu: File then “Save (current buffer)” Exit ◦ Ctrl-x Ctrl-c

Unix Commands When you log into a UNIX terminal ◦ You are in your home directory. ◦ To see the files in your directory.  ls ◦ To make an new folder/directory.  mkdir exampledir ◦ To change directories.  cd exampledir ◦ To go back one directory.  cd.. ◦ To go back to your home directory.  cd

Handling files cp file1 file2 ◦ copy file1 and call it file2 mv file1 file2 ◦ move or rename file1 to file2 rm file ◦ remove a file rmdir exampledir ◦ remove a directory cat file ◦ display contents of a file less file ◦ display a file a page at a time

Quiz!

Using Matlab Remotely Mac users: ◦ You already have an X-Windows environment PC users: ◦ You must setup Cygwin-X ◦ Download Cygwin setup.exe from: ◦ Run setup.exe and select additional packages for:  xauth  xinit  openssh

Running Matlab Remotely Once the X-Windows environment is setup, open a terminal window and login to strauss: ◦ ssh -Y Now start Matlab: ◦ matlab & What does the & do?

Conditions When you want to make a decision based on data “If traffic light is red, stop”

Conditions When you want to make a decision based on data “If traffic light is red, stop” ◦ Involves some comparison operator between data and a known value ◦ known value = red ◦ data = current state of the traffic light ◦ comparison operator is “equals”

Conditions When you want to make a decision based on data “If traffic light is red, stop” ◦ Involves some comparison operator between data and a known value ◦ known value = red ◦ data = current state of the traffic light ◦ comparison operator is “equals”  “If current state of traffic light equals red, stop”

Conditions If statement Many others (will talk about later)

IF Statements in Matlab IF statements allow program to make choices whether a condition is met or not Basic if statement if expression1 statements1 elseif expression2 statements2 else statements3 end

IF Statements in Matlab IF statements can be used with or without the ELSEIF and ELSE parts If you type: > x = 5 > if (x == 5) ‏ 200 end It will return: > 200

IF Statements in Matlab > x = 8 > if (x == 5) 200 elseif (x == 4) 300 else 400 end Will return: > 400

Condition operators equals ◦ == not equals ◦ ~= greater than ◦ > ◦ >= less than ◦ < ◦ <=

Matlab Loops Loops execute blocks of code repeatedly There are two types of loops ◦ For loops ◦ While loops (later in the course)

For Loops Used when you know how many times code is to be executed. Syntax for = : :

For Loops Used when you know how many times code is to be executed. Syntax for = : : Variable is initially the start value At end of iteration variable changes by increment If value is not greater than end the loop runs again. is optional, if not provided will be 1

Example Problem I want to find the average # of widgets sold in 4 days Day# of widgets sold Widget(1) = 15 Widget(2) = 22 Widget(3) = 20 Widget(4) = 18 Avg = (Widget(1) + Widget(2) + Widget(3) + Widget(4)) / 4

Example Problem I want to find the average # of widgets sold in 4 days Day# of widgets sold Widget(1) = 15 Widget(2) = 22 Widget(3) = 20 Widget(4) = 18 Avg = (Widget(1) + Widget(2) + Widget(3) + Widget(4)) / 4 ◦ This is easy for a small number of days. ◦ What if we had a 1000 days? ◦ We can use a for loop!

Example Problem total = 0; for i = 1:1:1000 loop starts at 1 total = total+widget (i);loop increments by 1 end loop ends at 1000 avg = total / i;

A Loop Analogy The mail man/woman executes a loop. If they know the number of deliveries For loop for delivery = start : next_delivery : end deliver_mail(delivery) end

Putting For loops and Ifs together for j = 1:10 if (j > 5) disp(j); end Will print what?

Group Exercise Create a for loop that finds all prime numbers between 1 and 100 ◦ pseudo-code ◦ hint: remember the math function modulus which gives the remainder of a division operation  In Matlab you can do mod(x,y)  mod(5,3) == 2

Lab02 Practice some unix commands Matlab script file sumIntsTest.m ◦ an example of a “unit test” Create new functions using loops/condition statements