MATHLAB Prepared for: Md. Monzur Ashraf Prepared By: Md. Shafiul Parvez Aakaash.

Slides:



Advertisements
Similar presentations
Chapter 0 Review of Algebra.
Advertisements

MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
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,
1 Chapter 13 Curve Fitting and Correlation This chapter will be concerned primarily with two separate but closely interrelated processes: (1) the fitting.
1 Eng. Mohamed El-Taher Eng. Ahmed Ibrahim. 2 1.FUNCTION SUMMARY polyfun  Polynomial functions are located in the MATLAB polyfun directory. For a complete.
Lecture 4 Structure plan Program design process Program design process Basic elements of code: Basic elements of code: –Input (assignment of variables)
1.3 ARRAYS, FILES, AND PLOTS + FOURIER SERIES BY MR. Q.
RATIONAL EXPRESSIONS Chapter Quotients of Monomials.
Lecture 16 Symbolic Mathematics Symbolic mathematics: algebraezplotcalculus © 2007 Daniel Valentine. All rights reserved. Published by Elsevier.
Introduction to MATLAB
Matlab Matlab is a powerful mathematical tool and this tutorial is intended to be an introduction to some of the functions that you might find useful.
ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW II.
Matlab intro The Environment
Major: All Engineering Majors Author(s): Autar Kaw
Algebra Review. Polynomial Manipulation Combine like terms, multiply, FOIL, factor, etc.
Algebra One Math Vocabulary.
ACSL, POSTECH1 MATLAB 입문 CHAPTER 8 Numerical calculus and differential equations.
CMPS1371 Introduction to Computing for Engineers NUMERICAL METHODS.
Chapters 5 and 6: Numerical Integration
Chapter 10 Review: Matrix Algebra
Systems and Matrices (Chapter5)
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Scientific Computing Linear Least Squares. Interpolation vs Approximation Recall: Given a set of (x,y) data points, Interpolation is the process of finding.
Curve Fitting and Interpolation: Lecture (I)
Hydroinformatics: Session4 Dr Ivan Stoianov Room 328B Dr Andrew Ireson (Room 304) Mr Juan Rodriguez-Sanchez (411A) Mr Baback.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
ΑΡΙΘΜΗΤΙΚΕΣ ΜΕΘΟΔΟΙ ΜΟΝΤΕΛΟΠΟΙΗΣΗΣ 4. Αριθμητική Επίλυση Συστημάτων Γραμμικών Εξισώσεων Gaussian elimination Gauss - Jordan 1.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
MATLAB Basics. The following screen will appear when you start up Matlab. All of the commands that will be discussed should be typed at the >> prompt.
ENE MATHLAB ® Lecture 3: Matrix Review. Determinant  To use MATLAB to compute determinants:  Enter the determinant as an array.  Use ‘det’ command.
4-5, 4-6 Factor and Remainder Theorems r is an x intercept of the graph of the function If r is a real number that is a zero of a function then x = r.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
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.
Scientific Computing General Least Squares. Polynomial Least Squares Polynomial Least Squares: We assume that the class of functions is the class of all.
MATLAB Jirawat Kanjanapitak (Tae). What is MATLAB A computer program for doing numerical computation including; Arithmetic, Polynomials, Graphics, 2-D.
Antiderivatives Indefinite Integrals. Definition  A function F is an antiderivative of f on an interval I if F’(x) = f(x) for all x in I.  Example:
1.1 Functions This section deals with the topic of functions, one of the most important topics in all of mathematics. Let’s discuss the idea of the Cartesian.
Numerical Analysis 3D Plots. A numerical method is a technique for computing a numerical approximation of the solution to a mathematical problem.
1. Overview 2. plot in 2D 3. Plot in 3D 4. Other possible charts 5. Engineers: label your plots! 6. Plots & Polynomial Plotting 11.
ACSL, POSTECH1 MATLAB 입문 CHAPTER 8 Numerical calculus and differential equations.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
Recap Cubic Spline Interpolation Multidimensional Interpolation Curve Fitting Linear Regression Polynomial Regression The Polyval Function The Interactive.
Polynomials, Curve Fitting and Interpolation. In this chapter will study Polynomials – functions of a special form that arise often in science and engineering.
PS 5-3 Integration –Discrete data –Polynomial functions Differentiation –Discrete data –Polynomial functions Roots (i.e., zeros) of functions –Polynomial.
Algebra 2A 7.1 September 19, Objectives Simplify rational expressions Simplify rational expressions Identify rational functions. Identify rational.
Antiderivatives and Indefinite Integration
Recap Functions with No input OR No output Determining The Number of Input and Output Arguments Local Variables Global Variables Creating ToolBox of Functions.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
1 Lecture 8 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
“Moh’d Sami” AshhabSummer 2008University of Jordan MATLAB By (Mohammed Sami) Ashhab University of Jordan Summer 2008.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
How to use MATLAB (using M-files) Double click this icon To start Matlab 6.5.
Mathematical Applications By Matlab 3 rd Day Dr. Wael Khedr CSI Dept.
EEE 244-3: MATRICES AND EQUATION SOLVING
10. Functions One quantity depends on another quantity
Chapter 7 Rational Expressions
ECE 1304 Introduction to Electrical and Computer Engineering
Differential Equations
Copyright © Cengage Learning. All rights reserved.
FE Exam Tutorial
Anti-differentiation
MATLAB DENC 2533 ECADD LAB 9.
EEE 244 Numerical Methods In Electrical Engineering
Symbolic mathematics: algebra ezplot calculus
Discrete Least Squares Approximation
Chapter 7: Matrices and Systems of Equations and Inequalities
EEE 244-3: MATRICES AND EQUATION SOLVING
Presentation transcript:

MATHLAB Prepared for: Md. Monzur Ashraf Prepared By: Md. Shafiul Parvez Aakaash

Prepared by: Md. Shafiul Parvez Aakaash BEGIN Let, a=4, b= -3 A=6 Variable names in MATHLAB represent matrix quantities. A row vector can be assigned as follows: a=[ ] A column vector can be entered as follows: b=[ 1; 2; 3; 4; 5] Or by transforming a row vector with ` operator b=[ ]`

Prepared by: Md. Shafiul Parvez Aakaash 2 Dimensional Matrix Representations A=[1 2 3;4 5 6;7 8 9] Or A=[1 2 3; 4 5 6; 7 8 9] A [press Enter] Who [Press Enter] Whose [Press Enter]

Prepared by: Md. Shafiul Parvez Aakaash Complex Variable i=sqrt(-1) X= 2+ i*4 ^ means exponent ional Y=pi/4 Y^2.45

Prepared by: Md. Shafiul Parvez Aakaash Graph Plotting To create a graph of t,y arrays command should be Plot (t, y) For Title: Title(‘ U ’r Text’) For X Label: Xlabel (‘ U ’r Text’) For Y Label: Ylabel (‘ U ’r Text’) Grid Example: X=[0:2:100] Y= sinX Plot (X,Y)

Prepared by: Md. Shafiul Parvez Aakaash Polynomials C=[ ] & then r=roots (c) Now roots of x 3 +x 2 +x+1=0 will be stored in r array.

Prepared by: Md. Shafiul Parvez Aakaash Solution Of Linear Equation A=[ ;2 3 5;3 2 -3] B=[2; -3 ; 6] X=inv (A)*B Or, X=A\B [It will apply Gauss Elimination internally] N.B: inv (A) makes inverse of matrix A

Prepared by: Md. Shafiul Parvez Aakaash Make Polynomial From Roots Procedure 1: >>A=[ 2,3] Ploy (A) 2. Evaluate Polynomial: >>Y=polyval (p,x) p is a vector of polynomial. x is a vector of X 3. Fit Polynomial To Data: >>Polyfit (X,Y,N) >>X= [ ] >>Y= [ ] Polyfit (X, Y, 3) Combine 2 & 3: Fn= polyfit (X,Y,3) Val= polyval ( fn, 4)

Prepared by: Md. Shafiul Parvez Aakaash Interpolation Let, X=[ ] Y=[ ] P=spline (X, Y, 2) 2 is the value of X Answer:

Prepared by: Md. Shafiul Parvez Aakaash Differentiation & Integration Question: f (x)=. 2+25x-200x x x x 5. From a=0 to b=.8 Answer: Write in Mfile function y= fx(X) y=.2+25*x-200*x.^2+675*x.^3- 900*x.^4+400*x.^5; Now, Save as fx.m >>q=quad (‘fx’, 0,.8) N.B: fx is the function name used in Mfile

Prepared by: Md. Shafiul Parvez Aakaash Tabular Data LET, >>X=[ ] >>Y=fx (X) N.B: For different value of X value of Y will be different >>integral=trapz (X, Y) >>diff (X) Summary in the next slide……….

Prepared by: Md. Shafiul Parvez Aakaash Summary Of Previous Method Result represents the difference between each pair of elements of x. To compute divided difference approximations of the derivative, we merely perform a vector division of the Y differences by the X differences by entering >>D= diff (Y)/ diff (X)

Prepared by: Md. Shafiul Parvez Aakaash Curve Fitting Technique In MATHLAB >>X=0:10 >>Y=sin (X) >>plot (X, Y) But If We Do So, >>P= polyfit ( X, Y, 5) >>X2=0:.25:10 >>Y2= polyval (P, X2) >>plot (X2, Y2) N.B: We will get a smooth curve except previous one.

Prepared by: Md. Shafiul Parvez Aakaash Circuit Solution Using MATHLAB LET, asin  t= L di / dt + q / C +Ri So, di/dt=1/L(asin  t- q/C – Ri) Let here, di=x (1) Here,  20 a=30 R=230 L=200 C=200 = 1 / 200 [ 30*sin (20*t) - q / *i] Dq/dt =i Let here, dq=x (2) Solution in the net slide……………………..

Prepared by: Md. Shafiul Parvez Aakaash Solution Of Previous Question In Mfile: function yp=circuit (t,x) yp= [(1/200)*(30*sin (20*t) – (x(2)/200) – (230*x(1)));x(1)]; In command Line: >>I=[0, 0] >>[t,x]=ode45 (‘circuit’,[0:01:10],ic); >>plot (t, x) N.B: ‘circuit’ is the name of Mfile that you are saved in this name. Hints: This Method is as like as Predator Pray method

Prepared by: Md. Shafiul Parvez Aakaash Numeric Solution Of ODE Question: dx/dt=.1x – y; dy/dy= x + 01*y; dz/dt= sin[(x2+y2)*t] Draw curve & find values of x, y, z W.R.T t ?

Prepared by: Md. Shafiul Parvez Aakaash Symbolic Expression #Symbolic expression never handle with the value of a variable. Example: >>syms X >>diff (X^3) #Output will be 3*X^2 #If you previously define >>X=3 After the symbolic expression (syms) Mathlab never handle with the value of X.

Prepared by: Md. Shafiul Parvez Aakaash Variable Precision Arithmetic Example: >> vpa 19/81 70 #Means, compute 19/81 up to 70 digits. OR, >>A=vpa(’80!’,200) #Means, Compute 80 factorial with 200 digits arithmetic.

Prepared by: Md. Shafiul Parvez Aakaash Length Of A Character See the previous example. f is a variable, contain the factorial of 80. Now I wanna know what is the total length of f. Put this command on Mathlab command prompt. >>length (char (f))

Prepared by: Md. Shafiul Parvez Aakaash Example Question: Employ the trapezoidal rule to evaluate the vertical distance by a rocket, if the vertical velocity is given by, V=10t 2 -5t 0<= t <=10 V=1000-5t 10<= t <=20 V=45t+2(t-20) 2 20<= t <=30 Hints: Solve in the next slide

Prepared by: Md. Shafiul Parvez Aakaash Solve Of Previous Question >>t=[0:29] >>V (1:10) =10*square (t(1:10))-5*t(1:10) >>V(11:20)=1000–5*t(11:20) >>V(21:30)=45*t(21:30)+2*square (t(21:30- 20) >>plot (t, V) >>trapz (t, V)