1 / 14

Engineering Analysis – Fall 2009

Engineering Analysis – Fall 2009. Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00. Lecture 3. Last time - Analytical and Numerical Methods for Model Solving Today: - Overview of Matlab - Laplace Transform

sburnes
Télécharger la présentation

Engineering Analysis – Fall 2009

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Engineering Analysis – Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00

  2. Lecture 3 • Last time - Analytical and Numerical Methods for Model Solving • Today: - Overview of Matlab - Laplace Transform - Solving differential equations using the Laplace Transform - Example • Next Time - Arrays in Matlab - Graphics - Number representation and roundoff errors Lecture 2

  3. Matlab • The workspace  The environment (address space) where all variables reside. • After carrying out a calculation, MATLAB assigns the result to the built-in variable called ans; • A “%” character marks the beginning of a comment line. • Three windows: • Command window – used to enter commands and data • Edit window- used to create and edit M-files (programs) such as the factor. For example, we can use the editor to create factor.m • Graphics window(s)- used to display plots and graphics Lecture 2

  4. Command window • Used to enter commands and data. The prompt is “>>” ; Allows the use of Matlab as a calculator when commands are typed in line by line, e.g., >> a = 77 -1 ans = 61 >> b = a * 10 ans =610 Lecture 2

  5. System commands • who/whos list all variables in the workspace • clear  removes all variables from the workspace • computer lists the system MATLAB is running on • version  lists the toolboxes (utilities) available Lecture 2

  6. Variables • Scalar and arrays; numerical data and text. • You do not need to pre-initialize a variable; if it does not exist, MATLAB will create it for you.

  7. Variable names • Variable names up to 31 alphanumeric characters (letters, numbers) and the underscore (_) symbol; must start with a letter. • Reserved names for variables and constants. ans - Most recent answer. eps - Floating point relative accuracy. realmax - Largest positive floating point number. realmin - Smallest positive floating point number. pi - 3.1415926535897.... i - Imaginary unit. j - Imaginary unit. inf - Infinity. nan - Not-a-Number. isnan - True for Not-a-Number. isinf - True for infinite elements. isfinite - True for finite elements. why - Succinct answer. Lecture 2

  8. Variable names (cont’d) • To report the value of variable kiki type its name: >> kiki kiki = 13 • To prevent the system from reporting the value of variable kiki append the semi-solon (;) at the end of a line: >> kiki = 13; Lecture 2

  9. Data display • The format command allows you to display real numbers • short - scaled fixed-point format with 5 digits • long - scaled fixed-point format with 15 digits for double and 7 digits for single • short eng - engineering format with at least 5 digits and a power that is a multiple of 3 (useful for SI prefixes) • The format does not affect the way data is stored internally

  10. Format Examples • >> format short; pians = 3.1416>> format long; pians = 3.14159265358979>> format short eng; pians = 3.1416e+000>> pi*10000ans = 31.4159e+003 • Note - the format remains the same unless another format command is issued.

  11. Script file - set of MATLAB commands • Example: the script factor.m: function fact = factor(n) x=1; for i=1:n x=x*i; end fact=x; %fprintf('Factor %6.3f %6.3f \n' n, fact); end • Scripts can be executed by: • (i) typing their name (without the .m) in the command window; • (ii) selecting the Debug, Run (or Save and Run) command in the editing window; or • (iii) hitting the F5 key while in the editing window. • Option (i) will run the file as it exists on the drive, options (ii) and (iii) save any edits to the file. Example: >> factor(12) ans = 479001600 Lecture 2

  12. Transform Methods • Basic idea: find a convenient representation of the equations describing a physical phenomena. • For example, in signal analysis rather than analyzing a function of time, s(t), study the spectrum of the signal S(f), in other words carry out the analysis in the frequency domain rather than the time domain. • Advantage of Fourier (spectral analysis): • More intuitive physical representation • Instead of correlation (an intensive numerically problem) use multiplication. Lecture 2

  13. Properties of the Laplace Transform • Linearity • Scaling • Frequency shifting • Time shifting • Frequency differentiation • Frequency integration • Differentiation • Integration • Convolution Lecture 2

  14. Lecture 2

More Related