MAE 1202: AEROSPACE PRACTICUM An Introduction to MATLAB: Part 2 Mechanical and Aerospace Engineering Department Florida Institute of Technology Developed.

Slides:



Advertisements
Similar presentations
(MICROSOFT EXCEL). Is a spreadsheet application designed to take advantage of the windows graphical interface MICROSOFT EXCEL.
Advertisements

Lab # 03- SS Basic Graphic Commands. Lab Objectives: To understand M-files principle. To plot multiple plots on a single graph. To use different parameters.
Introduction to MATLAB The language of Technical Computing.
Introduction to Engineering MATLAB – 11 Plotting - 4 Agenda Multiple curves Multiple plot.
Introduction to Matlab
Lecture (4) Plotting & Programming (1) Eng. Osama Talaat 1.
Introduction to Graphing Using MATLAB. Line Graphs  Useful for graphing functions  Useful for displaying data trends over time  Useful for showing.
Matlab Graphics S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: 2D Graphics.
Matrix Manipulation and 2D Plotting
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 19P. 1Winter Quarter MATLAB: Script and.
MA/CS375 Fall MA/CS 375 Fall 2002 Lecture 4.
Lecture 5 Review Programming Program Structures Comparison Repetition: looping or iteration Conditional execution: branching Bubble Sort.
Introduction to Matlab By: Dr. Maher O. EL-Ghossain.
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
MATLAB - Lecture 22A Two Dimensional Plots / Chapter 5 Topics Covered:
EGR106 Week 6 MATLAB FILES Two Dimensional Plots Multiple Plots
General Computer Science for Engineers CISC 106 Lecture 08 Dr. John Cavazos Computer and Information Sciences 2/27/2009.
Introduction to Matlab Tutorial for CS4MN3/SE3X03 Wen Yu McMaster University.
Introduction to MATLAB MECH 300H Spring Starting of MATLAB.
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
An introduction to Plotting in MATLAB Rikard Johansson Department of Biomedical Engineering (IMT) Linköping University
Matlab intro The Environment
EPSII 59:006 Spring Topics Using TextPad If Statements Relational Operators Nested If Statements Else and Elseif Clauses Logical Functions For Loops.
MATLAB and SimulinkLecture 11 To days Outline  Introduction  MATLAB Desktop  Basic Features  Branching Statements  Loops  Script file / Commando.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
Matlab tutorial course Lesson 2: Arrays and data types
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,
„  1999 BG Mobasseri1 9/18/2015 June 2 GRAPHICS IN MATLAB- PART I BASIC PLOTTING.
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
A Brief Introduction to Matlab Laila Guessous Dept. of Mechanical Engineering Oakland University.
ENGR 1320 Final Review - Programming Major Topics: – Functions and Scripts – Vector and Matrix Operations in Matlab Dot product Cross product – Plotting.
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
COMP 116: Introduction to Scientific Programming Lecture 6: Scripts and publishing, Creating matrices.
MATLAB Tutorial EE 327 Signals and Systems 1. What is MATLAB? MATLAB – Matrix Laboratory The premier number-crunching software Extremely useful for signal.
Numerical Computation Lecture 2: Introduction to Matlab Programming United International College.
COMP 116: Introduction to Scientific Programming Lecture 5: Plotting, Scripts and publishing.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Lecture 10 2D plotting & curve fitting Subplots Other 2-D Plots Other 2-D Plots Curve fitting © 2007 Daniel Valentine. All rights reserved. Published by.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Lecture 2 - Matlab Introduction CVEN 302 June 5, 2002.
Scientific Computing Introduction to Matlab Programming.
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display.
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Files: By the end of this class you should be able to: Prepare for EXAM 1. create an ASCII file describe the nature of an ASCII text Use and describe string.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
Introduction to Matlab
INTRODUCTION TO MATLAB DAVID COOPER SUMMER Course Layout SundayMondayTuesdayWednesdayThursdayFridaySaturday 67 Intro 89 Scripts 1011 Work
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
1 Lecture 5 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
ECE 351 M ATLAB I NTRODUCTION ( BY T EACHING A SSISTANTS )
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Introduction to Engineering MATLAB – 9 Plotting - 2 Agenda Formatting plots.
Chapter 4 MATLAB Programming MATLAB Troubleshooting Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Finishing up Chapter 5. Will this code enter the if statement? G=[30,55,10] if G
How to use MATLAB (using M-files) Double click this icon To start Matlab 6.5.
MATLAB How to use (using M-files) Double click this icon
MATLAB How to use (using M-files) Double click this icon
Plotting Multiple Graphs In The Same Plot
MATLAB How to use (using M-files)
INTRODUCTION TO MATLAB
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Presentation transcript:

MAE 1202: AEROSPACE PRACTICUM An Introduction to MATLAB: Part 2 Mechanical and Aerospace Engineering Department Florida Institute of Technology Developed by Joel M. Faure

Change current directory Change the current directory: Below the menu bar select the button Click the “+” (plus sign) next to MATLAB, and select the “Practicum _lab” folder Press the “OK” button

Create your first m-file Create an new m-file: –Go to “File>Save As>Practicum_lab_002>Select Save”

Initialize: Command, numerical array Command, String array Comment, Not executed line Continuation, continues commands on next line Standard numerical arrays/commands, usually black String arrays/commands, pink text, begins & ends with (‘’) Comments, green text, usually begins with percentage at the beginning Continuation, three dots (…) in blue text, means the commands will be executed in the next line. Any text that follows the continuation on the same line is a comment

Example 1: Review matrix multiplication & element by element multiplication Insert these matrices: –f True matrix multiplication: –“C=A*B” –“C=B*A” Element by element multiplication: –“C=A.*B” –“C=B.*A” Press the “F5” key on the keyboard to run the script

Example 2: Multiplying arrays and numbers element by element Multiplying arrays of numbers element by element: –Copy the screenshot –Why is there an error? –Comment out the line that does not make sense –Run the code

Intrinsic Matrices 1/2: ones(n): –Creates a square matrix with a size of nxn, each element is 1 “ones(5)” ones(n,m): –Creates a matrix with size of nxm, each element is 1 “ones(5,2)” zeros(n): –Creates a matrix with a size of nxn, each element is 0 “zeros(5)” zeros(n,m): –Creates a matrix with size of nxm, each element is 0 eye(n): –Creates an identity matrix. A square matrix that is all 0 except the diagonal is 1 “eye(5)” Example:

Intrinsic Matrices 2/2: Write down the next block of code, and run when complete:

Example 3: Curve Fitting with MATLAB 1/3 Plot x, y data and polynomial curve fit on a single plot, and adding a legend Change the curve fitted line style to red with circles on a plot Copy the commands for Example 3, and run the script 2 nd degree polynomial fit equation:

Example 3: Curve Fitting with MATLAB 2/3 Close the figure window at the conclusion of the lecture

Example 3: Curve Fitting with MATLAB, using polyval 3/3 Plot x, y data and polynomial curve fit on a single plot, and adding a legend Change the curve fitted line style to red with circles on a plot Copy the commands for Example 3, and run the script

Example 4: Normal Shock wave example using MATLAB 1/4 Determine Mach number behind the normal shock=M 1 with the input conditions: –Specific heat ratio= –Free-stream Mach=M 0 Plot M 1 vs. M 0 –Use for loops to create 2-D Matrices of M 1 data –Single plot with multiple lines, each line for a specific heat ratio, use the legend function –Add x-labels, y-labels, title, and turn the grid on –Use Mex/Tex symbols for specific heat ratio Copy the commands on the next slide and run the code.

Example 4: Normal Shock wave example using MATLAB 2/4

Example 4: Normal Shock wave example using MATLAB 3/4

Example 4: Normal Shock wave example using MATLAB 4/4 To access array subsets it is useful to use the colon “:” inside the index of the array –Follow the example on the screen, and run: Displays an element in the array Displays the entire contents of a row in the array Displays the entire contents of a column in the array Array subset, displays a range of row and column indices inside the array

In-Class Examples: In class examples 1-3 are NOT homework assignments and will not be turned in. –Do these on your time to get a better understanding of MATLAB Do the Introduction to MATLAB Lecture #2 in-class practice exercises –Example 1: Excel and MATLAB to generate circles, key point is to introduce axis equal –Example 2: Illustration of 3-D plotting for helix (change the helicity) –Example 3: Introduction to functions, program to generate unit vector from longitude and latitude coordinates –Extra credit: Use the mapping toolbox in MATLAB, and generate a map which shows the location of Florida Tech and your hometown