1 Yangon Technological University Department of Mechanical Engineering Computer Application In Mechanical Engineering I ME- 4019 Dr. Yin Yin Tun Deputy.

Slides:



Advertisements
Similar presentations
Introduction to MATLAB The language of Technical Computing.
Advertisements

Introduction to Matlab
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
MATLAB ME1107 Y Yan Reference: MATLAB for Engineers by Holly Moore (Pearson Prentice Hall)
General Computer Science for Engineers CISC 106 Lecture 04 Roger Craig Computer and Information Sciences 9/11/2009.
MATLAB Basics CS 111 Introduction to Computing in Engineering and Science.
General Computer Science for Engineers CISC 106 Lecture 07 Dr. John Cavazos Computer and Information Sciences 2/25/2009.
Introduction to Matlab Tutorial for CS4MN3/SE3X03 Wen Yu McMaster University.
Dr. Jie Zou PHY Welcome to PHY 3320 Computational Methods in Physics and Engineering.
Introduction to MATLAB
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Introduction to MATLAB ENGR 1187 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
MATLAB Fundamentals.
Chapter 4 MATLAB Programming Combining Loops and Logic Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
AN ENGINEER’S GUIDE TO MATLAB
MATLAB and SimulinkLecture 11 To days Outline  Introduction  MATLAB Desktop  Basic Features  Branching Statements  Loops  Script file / Commando.
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
THE MATLAB ENVIRONMENT VARIABLES BASIC COMMANDS HELP HP 100 – MATLAB Wednesday, 8/27/2014
Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,
Introduction to MATLAB
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
IC3003 B ASIC S CIENTIFIC C OMPUTING Lecture 1 Monday 08:30-11:30 U204a.
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
Introduction to MATLAB CBE 502 Mathematical Methods of Engineering Analysis.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB is a powerful program for numerical computations, plotting and programming.
A Brief Introduction to Matlab Laila Guessous Dept. of Mechanical Engineering Oakland University.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
INTRODUCTION TO MATLAB LAB# 01
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2010.
Introduction to Engineering MATLAB – 2 Introduction to MATLAB - 2 Agenda Defining Variables MATLAB Windows.
CMPS 1371 Introduction to Computing for Engineers MatLab.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
MATLAB Environment ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Recap Sum and Product Functions Matrix Size Function Variance and Standard Deviation Random Numbers Complex Numbers.
ES 240: Scientific and Engineering Computation. Chapter 2 Chapter 2: MATLAB Fundamentals Uchechukwu Ofoegbu Temple University.
ME6104: CAD. Module 4. ME6104: CAD. Module 4. Systems Realization Laboratory Module 4 Matlab ME 6104 – Fundamentals of Computer-Aided Design.
OUTLINE Overview Numbers, variables and similar in Matlab
ENG College of Engineering Engineering Education Innovation Center 1 More Script Files in MATLAB Script File I/O : Chapter 4 1.Global Variables.
Introduction to Matlab By E. Noura Semary. Contents MATLAB Environment  Command window, Workspace, Path window, Editor window,and Figure window) Basic.
Introduction to MATLAB 7 MATLAB Programming for Engineer Hassan Migdadi Spring 2013.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
Part 1 Chapter 2 MATLAB Fundamentals PowerPoints organized by Dr. Michael R. Gustafson II, Duke University and Prof. Steve Chapra, Tufts University All.
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.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
Introduction to MATLAB Zongqiang Liao Research Computing Group UNC-Chapel Hill.
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
Matlab for Engineers Matlab Environment Chapter 2.
MATLAB Lecture 1 염익준. Introduction MATLAB (MATrix LABoratory) a special purpose computer program optimized to perform engineering and scientific calculations.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
Interduction to MATLAB (part 2) Manal Alotaibi Mathematics department College of science King saud university.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Machine Learning Octave tutorial 데이터 마이닝 박 영 택.
An Introduction to Programming in Matlab Emily Blumenthal
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
Chapter 1 Computing Tools Variables, Scalars, and Arrays Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Matlab Workshop Getting Started.
ECE 1304 Introduction to Electrical and Computer Engineering
Arithmetic Operations
Introduction to Matlab
MATLAB DENC 2533 ECADD LAB 9.
MATLAB (Lecture 2) BY:MAHA ALMOUSA.
CS 111 Introduction to Computing in Engineering and Science
MATLAB (Lecture 2) BY:MAHA ALMOUSA.
ME 123 Computer Applications I Lecture 5: Input and Output 3/17/03
Electrical and Computer Engineering Department SUNY – New Paltz
Presentation transcript:

1 Yangon Technological University Department of Mechanical Engineering Computer Application In Mechanical Engineering I ME Dr. Yin Yin Tun Deputy Professor Department of Mechanical Engineering Yangon Technological University

2 Chapter One Introduction to Computers Problem-solving Methodology State the problem clearly Describe the input and output information Work the problem by hand for simple data set Develop a Matlab solution Test the solution with a variety of data

3 Matlab Windows Command Window Edit Window Graphic Window Scalars, Vectors and Matrices Case sensitive, X  x Scalar, X = 5; Vector, Y = [4, 5]; Matrix, Z = [-1, 0, 2; -2, 1, 3; -3, 4, -4]; Chapter Two Matlab Environment 1st row2nd row3rd row Row break Suppress printing

4 Variable name must be start with a letter Variable name can contain letters, and the underscore ( _ ) Variabel name must be unique within 19 characters my_database1 = [32, 50, 80]; z = [-1, 0, 2, -2, 1, 3, -3, 4, -4]; Z = [-1, 0, 2; -2, 1, 3; -3, 4, -4]; Zpartial_a = Z(:,2:3); Zpartial_b = Z(2:3, 1:2); User input: a = input(`enter values for z in brackets´); Load data file save -ascii Initializing Variables z(4) Z(2,3) Zpartial_a Zpartial_b

5 Data Format Formatted Output: fprintf(format string, variables) Display format: %e (exponential notation) %f (decimal notation) %g (exponential or decimal, which is shorter) short (default)  long (14 decimal)  short e (4 decimal)  e+01 long e (15 decimal)  e+01 bank (2 decimal)  (+, - or blank)  + %8.1f  _ _ _ _ 15.2

6 Printing Matrices x = 0: 0.2: 2; fprintf(`%3.1f * 5 = %4.1f \n´, x, x); Display followings: 0.0 * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = 2.0 x = 0: 0.2: 2; n = size(x); for i = 1: n(2) fprintf(`%3.1f * 5 = %4.1f \n´,x(i), x(i)*5); end Display followings: 0.0 * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = * 5 = 10.0

7 Useful Commands and Functions clc, clg clear, clear all, disp, fprintf grid on, grid off hold on, hold off input, load, plot save, size title, xlabel, ylabel figure sum, min, max, mean transpose: A´ new line: \n power: A^4 square root: sqrt(A) absolute value: abs(A) Round nearest integer: round(A) Round nearest integer (-  ): floor(A) Round nearest integer (+  ): ceil(A) Remainder of A/B: rem(A,B) Exponential of A: exp(A) Trigo functions(A in radians): cos(A), sin(A), tan(A), asin(A), acos(A), atan(A), atan2(y,x)  : pi ( )

8 Chapter 3 Fundamental Engineering Computations Matrices and Matrices Operations A = zeros(3); B = ones(3,2); C = [1 2 3; 3 4 5]; D = zeros(size(C)); E = eye(6); F = eye(3,2); Diag(E); V = [2, 4, 6, 8]; diag(V,0); Scalar and Array Operation A+B  A+B, A.+ B A – B  A-B,A.– B A  B  A*B,A.* B A  B  A/B,A./ B B  A  A\B,A.\B A B  A^B,A.^B

9 Chapter 4 Two-Dimensional Arrays and Matrices Building a Matrix out of Vectors price = [3, , 9.15, 1.29]; Jan = [3, 2, 1, 5, 2]; Feb = [2, 3, 1, 3, 3]; Mar = [1, 0, 3, 3, 3]; tot_Jan = price * Jan´; tot_Feb = price * Feb´; tot_Mar = price * Mar´; quantity = [Jan´, Feb´, Mar´]; quant = [Jan; Feb; Mar]´; Vector by Matrix Multiplication [1  m] * [m  n] = [1  n] Matrix by Matrix Multiplication [l  m] * [m  n] = [l  n]

10 Examples Example 3.1 Step 1  compute the avg. of a set of temp., and plot time vs. temp. Step 2  input : temp, output : avg. temp and plot time vs. temp. Step 3  hand calculation: avg. temp. =  temps/count = deg. F Step 4  Matlab Soln. (for simple) time = [0.0, 0.5, 1.0]; temps = [105, 126, 119]; average = mean(temps); plot(time, temps); title(`temperature Measurements´); xlabel(`time, minute‘); ylabel(`temperature, deg. F´); grid on; Step 5  testing the solution, and checking the results by comparing with hand calculation results. If the Matlab soln. is correct, data are replaced with the data given in question.

11 Continued Example 4.6 Step 1  to find the center of gravity of the system Step 2  input : masses, distances, output: center of gravity Step 3  hand calculation: c.g =  (m  d)/  m = mm Step 4  Matlab Soln. (for simple) mass = [35, 65, 45, 75]; dist = [400, 580, 800, 1000]; moments = mass.* dist; total_moment = mass * dist‘; M = sum(mass); Cg = total_moment/M; (OR) Cg = (mass * dist‘)/sum(mass); Step 5  testing the solution, and checking the results by comparing with hand calculation results. If the Matlab soln. is correct, data are replaced with the data given in question.

12 Sample Workout Example Chapter 5, Prob. 3 Step 5  Matlab Soln. w = [195, 90, 25, 0.8]; cg = [3.0, 1.4, 1.5; 2.3, 1.4, 1.7; 0.7, 1.4, 1.4; 3.1, 2.1, 1.5]; wt = sum(w); CG = w * cg /wt; dw = CG(2); dc = CG(3); Fc = wt * dw/dc; r = 8; g = 9.81; V = sqrt((Fc * r * g/wt)*(3600/1000)^2); Vel = input(`Enter velocity of truck in km/hr´); FC = (wt/g) * (Vel * 1000/3600)^2/r; S = FC * dc /(wt*dw); If S > 1 Disp(´the truck would overturn in this operation´); Elseif S < 1 Disp(´the truck would not overturn in this operation´); Else Disp(´this operation is in the critical point´); end

13 Thank You Very Much!