Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 1Winter Quarter Propulsion Lab with.

Slides:



Advertisements
Similar presentations
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect FXP. 1Winter Quarter Course Wrap Up and Final Review Topics Lecture.
Advertisements

259 Lecture 17 Working with Data in MATLAB. Overview  In this lecture, we’ll look at some commands that are useful for working with data!  fzero  sum,
Introduction to Matlab
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 20P. 1Winter Quarter Propulsion Lab with MATLAB Lecture 20.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 19P. 1Winter Quarter MATLAB: Script and.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect FXP. 1Winter Quarter Course Wrap Up and.
Lecture 5 Review Programming Program Structures Comparison Repetition: looping or iteration Conditional execution: branching Bubble Sort.
Soft Computing 1 Matlab Tutorial Kai Goebel, Bill Cheetham RPI/GE CRD
Introduction to Matlab By: Dr. Maher O. EL-Ghossain.
Introduction to MATLAB
Lecture 7 Sept 17 Goals: Complete Chapter 4 Chapters 5 and 6.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 18P. 1Winter Quarter Introduction to MATLAB.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 11P. 1Winter Quarter Arrays Lecture 11.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect M1 P. 1Winter Quarter Midterm I Review Topics.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 6P. 1Winter Quarter I/O in C Lecture 6.
Matlab Intro. Outline Matlab introduction Matlab elements Types Variables Matrices.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect M2P. 1Winter Quarter Midterm 2 Review Topics.
Matlab Basics IEF 217a: Lecture 2 Fall 2002 Sigmon and Davis, chapters 1-7.
Introduction to MATLAB MECH 300H Spring Starting of MATLAB.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect FXP. 1Winter Quarter Course Wrap Up and.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 21P. 1Winter Quarter MATLAB: Structures.
1 Introduction to MATLAB MATLAB is all of the following: 1.Computational environment 2.Plotting software 3.Programming language Typical applications: 1.Calculations.
MATLAB File Management. MATLAB User File Management Matlab provides a group of commands to manage user files. For more information, type help iofun. pwd.
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Arrays 1 Multiple values per variable. Why arrays? Can you collect one value from the user? How about two? Twenty? Two hundred? How about… I need to collect.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 1Winter Quarter C++ Lecture 24.
Matlab for Engineers Manipulating Matlab Matrices Chapter 4.
MAE 1202: AEROSPACE PRACTICUM An Introduction to MATLAB: Part 2 Mechanical and Aerospace Engineering Department Florida Institute of Technology Developed.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 22P. 1Winter Quarter MATLAB: Simultaneous Equations Lecture 22.
Matlab Basics FIN250f: Lecture 3 Spring 2010 Grifths Web Notes.
Introduction to MATLAB. CSPP58001 MATLAB MATLAB is is a matrix-based language well suited for carrying out numerical analysis. It has many, many high-
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 18P. 1Winter Quarter Introduction to MATLAB Lecture 18.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
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.
MATLAB Lecture Two Tuesday 5 July Chapter 3.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
CSE123 Lecture 3 Files and File ManagementScripts.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
EGR 115 Introduction to Computing for Engineers Designing The Battleship Game in MATLAB Monday 22 Sept 2014 EGR 115 Introduction to Computing for Engineers.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 3: Array Operations Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 22P. 1Winter Quarter MATLAB: Simultaneous.
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 11P. 1Winter Quarter Arrays Lecture 11.
CMPS 1371 Introduction to Computing for Engineers VECTORS.
CSE 455 : Computer Vision MATLAB 101 Getting Started with MATLAB.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect M2P. 1Winter Quarter Midterm II Review Topics Lecture M2.
SCRIPTS AND FUNCTIONS DAVID COOPER SUMMER Extensions MATLAB has two main extension types.m for functions and scripts and.mat for variable save files.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
EGR 115 Introduction to Computing for Engineers Loops and Vectorization – Part 3 Friday 17 Oct 2014 EGR 115 Introduction to Computing for Engineers.
An Introduction to Programming in Matlab Emily Blumenthal
Beginning Programming for Engineers Animation. Special matrix functions >> clear >> ones(2,3) >> zeros(3,5) >> ones(2) >> zeros(3) >> eye(4) >> magic(4)
LAB 2 Vectors and Matrices Dr.Abdel Fattah FARES.
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators.
13.4 Product of Two Matrices
12-1 Organizing Data Using Matrices
Manipulating MATLAB Matrices Chapter 4
Functions (subprograms)
MATLAB: Structures and File I/O
MATLAB: Script and Function Files
funCTIONs and Data Import/Export
Matlab Intro.
MATLAB: Script and Function Files
Matlab Intro.
ME 123 Computer Applications I Lecture 5: Input and Output 3/17/03
Presentation transcript:

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 1Winter Quarter Propulsion Lab with MATLAB Lecture 20

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 2Winter Quarter Recording a Session With the MATLAB Diary Command MATLAB provides a diary feature to capture the text from a MATLAB session in an ASCII text file. The commands to use it are: –>> diary filename % Start a diary –>> diary % Toggles diary on/off –>> diary on % Activates diary –>> diary off % Suspends diary

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 3Winter Quarter Propulsion Lab Data Reduction with MATLAB Algorithm –Use a text editor to open the data file, remove the header lines and save the file. –Start MATLAB. Select working directory if appropriate. –Start a diary. Thereafter, turn on or off as appropriate. –Load the data file. –Display the matrix to determine what column to use for the thrust vector.

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 4Winter Quarter Propulsion Lab Data Reduction with MATLAB –Create thrust vector. –Plot thrust vector against its index. –Examine the plot to determine: index when “burn” starts index when “burn” ends index when retro fires to deploy chute –Create “burn_thrust” sub-vector using elements of thrust vector between “burn start” index and “burn end” index

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 5Winter Quarter Propulsion Lab Data Reduction with MATLAB –Calculate impulse by calculating area under plot curve between “burn start” and “burn end”. –To do this, multiply each element of “burn” sub-vector by sampling period and thrust stand's calibration factor.

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 6Winter Quarter Propulsion Lab Data Reduction with MATLAB –Examine raw data at ends of “burn” sub-vector to determine whether pre-burn values were actually zero. –If they were not, some "weight" was counted as thrust. Subtract appropriate amount from impulse.

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 7Winter Quarter Sample Plot From Rocket Motor Test

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 8Winter Quarter Extracting a Sub-Matrix A portion of a matrix can be extracted and stored in a smaller matrix by specifying the names of both matrices and the rows and columns to extract. The syntax is: sub_matrix = matrix ( r1 : r2, c1 : c2 ) ; where r1 and r2 specify the beginning and ending rows and c1 and c2 specify the beginning and ending columns to use for the new matrix.

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 9Winter Quarter Extracting a Sub-Vector In a similar fashion as with a matrix, a sub-vector can be created using elements m through n of an existing vector as follows: my_sub_vector = my_vector ( m : n ) ;

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 10Winter Quarter Summing the Elements of a Vector or Matrix All the elements of a vector can be added up using the sum command as follows: total = sum ( my_sub_vector) ; All the columns of a matrix may be summed with the command: total_vector = sum (my_matrix) ; It returns a vector containing the sums of each column. That can then be summed to sum the entire matrix.

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 11Winter Quarter Examining Plots With the MATLAB Axis Command MATLAB plots are created with default axes that display the entire plot. An axis command can be used after the plot is created to “zoom in” on a portion of the plot. The command is: axis ( [ x1 x2 y1 y2 ] ) ; Where x1 and x2 are the x-axis min and max values and y1 and y2 are the y-axis values to use. The axis command can be used repeatedly to display various portions of the plot.

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 12Winter Quarter Selecting Coordinates from Plots With the MATLAB Ginput Command The coordinates of points on a plot can be input into MATLAB using the function ginput. The syntax is: [ x, y ] = ginput ( n ) ; It places a full-window, mouse-able cross-hair on the plot and the user can select n points. The x-coordinates of the points are stored in the vector x and the y-coordinates in the vector y.