ENGR13200_Sp2012_ICA01A_Problems

ENGR13200_Sp2012_ICA01A_Problems - ENGR 13200 Spring 2012...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ENGR 13200 – Spring 2012 Activities 1-4 Class 1a In Class Activities : Completed in-class activity documents must be uploaded to your Instructor’s Blackboard ICA### Dropbox prior to the next class . All uploads must be done individually even if you worked with a partner. Partner names should appear in all documents that were worked with one or more partners. Completion of activities is part of the in-class participation grade and submissions may be subject to grading. Class1a : Complete the ENGR13200_Sp2012_ICA01A_AnswerSheet.docx as you and a partner go through Activities 1 through 4. Upload this form to Blackboard as instructed above. Activity 1: MATLAB Variables (Estimated Time: 15 minutes) This activity will familiarize you with variable assignments in MATLAB. 1. Solving engineering problems with MATLAB will require values to be assigned to variable names. MATLAB has rules for selecting these variable names. In the Command Window, type (only type the bold): >> Tool = 5 >> tool = 6.2222 >> who 2. You now have two variables in a name that would be spoken as "tool". To review the values stored in each variable name, just type the variable name in the Command Window. Type: >> tool >> Tool The variables available in the workspace can also be viewed in the Workspace window. Note that the values are different for "Tool" and "tool". MATLAB is case-sensitive, so mixing upper and lowercase letters will result in different variable names. TOOL, tOoL, TooL, tOOl, tooL, toOl, toOL are all different variable names. This can lead to confusion to you when debugging a program. Make sure your variable names are distinct. 3. To clear variables from the workspace, use the clear function. To clear a single variable, you would type clear variable_name . In the Command Window, type: >> who >> clear tool >> who How did the result of each "who" function differ? 4. Names can be any combination of letters and numbers. MATLAB uses just the first 63 characters to differentiate between variable names. At the MATLAB prompt, type: >> variable1=1 >> 2ndvariable=2 Notice the error that results when placing a number at the beginning of a variable name. Numbers are acceptable at the end or within a variable name (e.g., variable1 or var2nd) but
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ENGR 13200 – Spring 2012 Activities 1-4 Class 1a not at the beginning. Variable names must begin with a letter. It is good programming practice to use descriptive names for variables so that you can quickly identify what the variables mean rather than one or two letter variable names (though trying to be too
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/17/2012 for the course ENGR 132 taught by Professor Kutson during the Spring '11 term at Purdue.

Page1 / 6

ENGR13200_Sp2012_ICA01A_Problems - ENGR 13200 Spring 2012...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online