×

### Let's log you in.

or

Don't have a StudySoup account? Create one here!

×

or

## Computing for Engineers

by: Mrs. Alaina Hermiston

30

0

3

# Computing for Engineers ENGR 1731

Mrs. Alaina Hermiston
GSU
GPA 3.62

Maria Alba-Flores

These notes were just uploaded, and will be ready to view shortly.

Either way, we'll remind you when they're ready :)

Get a free preview of these Notes, just enter your email below.

×
Unlock Preview

COURSE
PROF.
Maria Alba-Flores
TYPE
Class Notes
PAGES
3
WORDS
KARMA
25 ?

## Popular in General Engineering

This 3 page Class Notes was uploaded by Mrs. Alaina Hermiston on Monday October 12, 2015. The Class Notes belongs to ENGR 1731 at Georgia Southern University taught by Maria Alba-Flores in Fall. Since its upload, it has received 30 views. For similar materials see /class/222069/engr-1731-georgia-southern-university in General Engineering at Georgia Southern University.

×

## Reviews for Computing for Engineers

×

×

### What is Karma?

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/12/15
E NGR 1731 Computing for Engineers Mechanical and Electrical Engineering technology Lecture 10 Strings fprintf function if elseif else structure Prof AlbaaFlores 2182009 Documentation in Programs Examples 1 Poor program descriptions of Lab 5 are Jane Doe ENGR 1731C Lab 5 February 12 2009 96 This iab teaches the basics of switcbscasesotberwl39se and how it is used 96 John Doe 96 Engr 1731C 96 Lab 5 021209 as This program will calculate the given runction with the number x Jane Doe ENGR 1731C Lab 5 021209 as This lab will ask user to inputa number to convert itto a dirrerent one as requested by theuser Documentation in programs cont 2A Good program description of Lab 5 is Program name lab5m lane Doe February 52 0 ENGR 1731c Lab 5 SNl39tcbsCasesotberwl39se structure This program perrorms various calculator functions The functions itpertorrns are sine ine tangent square root cos inverse souare natural log and common log log 10 e e e e gee e e e e Request for the number to be processed xl39nput 39Enter the numberx39 Documentation in programs cont 3 An excellent program description of Lab 5 is Program name lab5m created unFebruary 122009 by Jane Doe quoto quoto ENGR 1731C Lab 5 Switchrczserutherwlse Structure as This program perrorrnsvariouscalculatorrunctions The runctions it perrorms are sine co sinetangent square root inverse square natural logandcommonlog log 10 as input variable as x numberto be processed quoto if the function to evziuzte lslelE cosine urtzngent thenthe number as x should be given in radians output Variable as v istherunctionorthe numberx as The allowed runctionsrorthisprogram are as s or s rorsine c or c rorcosin t orT rortangent as r or rorsouar i orl furlx a or o fursquared as l or L rornaturallog o or o rorlog 1000 as Requestfurthe number to be processed xinputtnterthe numberx eroot Strings A string is a set of characters llettersl that form an army lorstringl The string is actually a vectorwhose components are the numeric codes forthe letters codes are ASCIIl The length ofS is the numberofcharacters A quotation within the string is indicated by two quotes Syntax letters 39Any characters39 Strings cont sentence wordl wordZ word3 concatenate character arrays word 1 wordz word3 mto a new character array sentence Examples msg 39You39 39are39 39rlghtl39 name 39Thomas39 39 R 39 39Lee39 5 39Hello39 39Yes39 39No39 39Goodbye39l Outside 1nput39It 13 sunny 7 y or N 39 39539 2182009 fprintf Write formatted function Tne prmcu function WiH piace output anthe screen with the Specified format Requires a conversion characterlar eacn variabielhalwiii be senua the screen mveman hammer so Singie haratter m Denmai mutater isigne i u apanennai notation using a inwertase e as in 1a1seuui u apanennai notation using an upperrase r as m 1 1415mm u Fixe rpmntrmtatmn u Stringnftharatters fpr intf Examples fpzauttfi 39calox as Number 5 stringlarmalieieuersnatnumbers a means demmai numberna format is spem ed 951 5f xrpmntlarmat Tne 1 means minimum all integer the 5 means 5 digits mne ngnmnne decimai paint n means newime fprintf Examples rarmr earar m1 1 a m2 1 1 3 w a an texcz vellaw x e 55 y 355 rammed a s m1 1 a me u 1 3 w err r y Usingthe Matlabfunciton fprintf s Th1 example computes the cublc e an array of numbers to 5 th lucrements of 05 memay rhe reeu1renr array an Not very user r1ena1y amar dlspi ThE eume unermr 1e 1 m a more user r1ena1y armar fprlncii ThE Duh unermr 1a 12 15 n r Vi fprlncii ThE Duh unermr 1a 12 13 n r Vi Decision Making amp Loops Decisions in most engineering applications we need to make decisions in order to solve the problem Most decisions are based on the value of some parameter When we write the MATLAB program used to find the result the decisions will be used to control the execution the progmm Decision Implementation In order to implement the decision statement in MATLAB we have three different structures a If structure b If elseif else structure c The Switch or Case structure 2182009 if Structure The if statement is used to test the value of a variabl If the result of the test is true then the list of commands inside the structure is executed if it is false the list of commands is not executed 0 If structure syntax if condition commands end if Structure Commands Conditions that can be Tested Some of the types of conditions that a variable can be tested for are Value equal Value not equal Value positive Value negative Value largerthan Value less than If else Structure The tfelse statement is used to test the value of a variable Ifthe result of the test is true then one list of commands is executed if it is false the second list of commands is executed if condition commands 1 else commands 2 end ifelse Structure True False Commands 2

×

×

### BOOM! Enjoy Your Free Notes!

×

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

Jim McGreen Ohio University

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Jennifer McGill UCSF Med School

#### "Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over \$500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

Jim McGreen Ohio University

Forbes

#### "Their 'Elite Notetakers' are making over \$1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!
×

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com