1 DKT 211 Basic Communication Engineering LAB # 1A : (Lecture 1) Introduction to Matlab  Basic Features  Scientific features  Array Operations  Script.

Slides:



Advertisements
Similar presentations
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.
Advertisements

MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
Introduction to Matlab EE 2303 Lab. MATLAB stands for “Matrix Laboratory” APPLICATIONS OF MATLAB:  Mathematical Calculations  Data Analysis & Visualization.
MATLAB’s extensive, device-independent plotting capabilities are one of its most powerful features. They make it very easy to plot any data at any time.
Introduction to Matlab. I use Matlab for: Data analysis Data plotting Image Analysis Also – Simulations (solving odes/pdes/finite element methods) – Minimisations,
MATLAB ME1107 Y Yan Reference: MATLAB for Engineers by Holly Moore (Pearson Prentice Hall)
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
Introduction to MATLAB 3 November Instructor: Andy Newman Office Hours: Stop by room 306 (main building) whenever
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
Introduction to Matlab Jianguo Wang CSSCR September 2009.
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.
Programming For Nuclear Engineers Lecture 12 MATLAB (3) 1.
MATLAB Fundamentals.
What is MATLAB ? MATrix LABratory –Originally, it was a front-end to FORTRAN matrix routines developed in the U. of New Mexico and Stanford –Today.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Martin Ellison University of Warwick and CEPR Bank of England, December 2005 Introduction to MATLAB.
ENGR 1181 College of Engineering Engineering Education Innovation Center Excel 1.
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.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Introduction to MATLAB ENGR 1181 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
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 Harri Saarnisaari, Part of Simulations and Tools for Telecommunication Course.
Recap Sum and Product Functions Matrix Size Function Variance and Standard Deviation Random Numbers Complex Numbers.
Lecture 2 - Matlab Introduction CVEN 302 June 5, 2002.
Matlab 14.html Cost: $100 Available in labs on Windows and Unix machines.
Introduction to MATLAB ENGR 1181 MATLAB 1. Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All.
ES 240: Scientific and Engineering Computation. Chapter 2 Chapter 2: MATLAB Fundamentals Uchechukwu Ofoegbu Temple University.
1 Week 1: Variables, assignment, expressions READING: 1.2 – 1.4.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Master in Optical Fiber Communications and Photonic Technologies Foundations of Digital Transmission - Fall quarter Introduction to Matlab.
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.
Matlab. Textbooks Required:, by Palm (3 rd edition) Required: Introduction to MATLAB for Engineers, by Palm (3 rd edition)
1 Lecture 1 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Part 1 Chapter 2 MATLAB Fundamentals PowerPoints organized by Dr. Michael R. Gustafson II, Duke University and Prof. Steve Chapra, Tufts University All.
Recap Chapter 5 “Plotting” Two Dimensional Plots Simple x-y Plots Titles, Labels and Grids Multiple Plots.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
ENG 1181 First-Year Engineering Program College of Engineering Engineering Education Innovation Center First-Year Engineering Program MAT - Introduction.
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.
Matlab for Engineers Matlab Environment Chapter 2.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.1 Simple Plot of Time.
CS100A, Fall 1998, Lecture 201 CS100A, Fall 1998 Lecture 20, Tuesday Nov 10 More Matlab Concepts: plotting (cont.) 2-D arrays Control structures: while,
Structured Computer Programming EE 201 Introduction to MATLAB 7 for Engineers بسم الله الرحمن الرحيم King Abdulaziz University College of Engineering Dept.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
ECE 1304 Introduction to Electrical and Computer Engineering
Lecture 25.
Two-Dimensional Plots
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
MATH 493 Introduction to MATLAB
Use of Mathematics using Technology (Maltlab)
INTRODUCTION TO MATLAB
Experiment No. (1) - an introduction to MATLAB
MATLAB Introduction MATLAB can be thought of as a powerful graphing calculator but with a lot more buttons! It is also a programming language, commands.
Presentation transcript:

1 DKT 211 Basic Communication Engineering LAB # 1A : (Lecture 1) Introduction to Matlab  Basic Features  Scientific features  Array Operations  Script Files or M-files

2 Basic Features Matlab is a tool for doing numerical computations with matrices and vectors. It can also display information graphically. The best way to learn to use Matlab is to run Matlab, trying the examples and experimenting.

3 Simple Math Matlab can be used as a calculator (Text in yellow is what you type, text in blue is what the computer “types” back): >> ans = 12 >> 2 * 4 + 6*2 - 8/2 ans = 16

4 Operation and Symbol OperationSymbolExample Addition, a + b Subtraction, a – b Multiplication, a x b Division, a ÷ b Power, a + - * / ^ *2.1 10/2.5 3^2

5 Expressions Expressions are evaluated from left to right with the power operation having the higher order of precedence, followed by both addition and subtraction having equal precedence Paratheses are used to alter this usual ordering. Evaluation initiates within the innermost parentheses and proceeds outward >>3^ / 3*2 ans= 0

6 The Matlab Workspace Matlab remembers the command you enter as wellas the values of any variables you create. These command and variables are said to reside in the Matlab Workspace and can be recalled whenever you wish. >>a = 4 a = 4 >>a a = 4

7 Number Display Formats When a result is an integer, Matlab displays it as an integer. >> a = 4; >> b = 2; >> c = a*b; c = 8

8 Number Display Formats When a result is a real number, Matlab displays it with four digits to the right of t6he decimal point. >> a = 4; >> b = 2; >> c = a/b; c = 1.333

9 Variables in Matlab Variables are case sensitive (apple, Apple and APPLE). Variables can contain up to 19 characters. Variables must start with a letter, followed by any number of letters, digits, or underscores

10 When Matlab performs a calculation, it does so using the values it knows at the time the requested command is evaluated. >> a= 4; >> b= 3; >> c= a + b c= 7 >> b= 5; >> c= a + b c= 9

11 Variables in the Matlab workspace can be unconditionally deleted by using the command clear. >> clear a >> a ??? Undefined function or variable ‘a’ >> clear b >> b ??? Undefined function or variable ‘b’

12 Summary Matlab knows addition (+),substraction (-), multiplication (*), division (/), and power (^). Matlab evaluates expressions from left to right giving precedence to power over multiplication and division and these over addition and subtraction A semicolon(;) at the end of a Matlab statement suppresses printing of results. If statement too long, type three periods (…) followed by Enter to continue the Matlab statement on the next line.

13 Summary (cont.) As a default, Matlab stores results in the variable ans. Matlab remembers only the first 19 charactes of a variable name. Variable must begin with letter. Matlab is case sensitive. Comments in Matlab begin with %

14 Scientific Features Matlab offers many common functions important to mathematics, engineering, and the sciences. Matlab handles complex numbers

15 Common Mathematical Functions >> a=sqrt(9)/2 a = >> b=sin(a/2) b = >> c=round(a)*(b*180/pi) c =

16 Complex numbers In matlab, the conversion between polar and rectangular form make use of the functions real, imag, abs, and angle: >> a=1-2i a = i >> abs(a) ans = >> real(a) ans = 1

17 >> imag(a) ans = -2 >> b_angle=angle(a) b_angle = >> b_degree=b_angle*180/pi b_degree =

18 Script files, or M-files Matlab commands can be placed in a text file, called script or M-file. To create M-file choose New from the File menu and select M-file. This procedure brings up a text editor window. Commands within the M-file have acces to all variables in the Matlab workspace, and all variables created in the M-file become part of the workspace.

19 Matlab Graphics Creating Simple Plots Manipulating Plots

20 Creating Simple Plots Plots are a powerful visual way to interpret data Matlab has an extensive graphics capabilities

21 Case Study #1: y=sin( x ) Plot a sine function over one period: y = sin( x ) for 0≤ x ≤2π First we choose data point for the independent variable x. This data forms the horizontal axes of the plot. Then the sine of each data point is found – this provides the vertical axes of the plot. Each pair { x,y } is then marked on a suitable set of axes.

22 Case Study #1: y=sin( x ) (cont.) Matlab uses arrays to accomplish this task: >> x= linspace(0,2*pi,30); creates 30 points between 0 and 2π. >>y=sin(x); finds the sine of the point in x. >>plot(x,y) generates the plot.

23 Case Study #1: y=sin( x ) (cont.)

24 Case Study #1: y=sin( x ) (cont.) The Matlab function plot automatically chooses axis limits, Marks the individual data points, and Draws straight lines between them.

25 Options in the plot command allow us to plot multiple data sets on the same axes, Use different line types (dotted and dashes), Mark just the data points without drawing lines between them, Use different colors for curves, Place labels on the axes, a title on the top, Draw a grid at the tick marks.

26 >>z = cos(x); >>plot(x,y,x,z)

27 Plot 2sin(x)cos(x) using dashed lines >>plot(x,y,x,2*y*z,’--’)

28 Places a grid at the tick marks of the current plot. >>grid

29 Plots sine versus cosine >>plot(y,z)

30 Case Study #2:Plot the gain of the low pass filter versus the frequency. Given parameters are as follow: Range of the frequencies : 0Hz -100KHz. value of resistor and capacitor: R=10k ohm and C=0.0033µ Farads Cutoff frequency, ω=1/RC Theoretical Gain, G=1/√(1+(2πfRC)^2) Measured gain=[ ] Frequencies at which gain were measured (Hz): =[ ]

31 Case Study #2:Plot the gain of the low pass filter versus the frequency.(cont.) First you have to set the initial parameters >>f=0:100000; >>R=10000; C=3.3*10^(-9); Then calculate the theoretical cutoff frequency and theoretical gain >>fc=1/(2*pi*R*C); >>Gt=sqrt(1./(1+(2*pi*R*C.*f).^2)); Next, plot Gt versus f >> plot (f, Gt,’r’)

32 Case Study #2:Plot the gain of the low pass filter versus the frequency.(cont.)

33 EXERCISE SESSION