FDP on Electronic Design Tools - Computing with MATLAB 13/12/2017. A hands-on training session on. Computing with MATLAB
|
|
- Scarlett Hall
- 5 years ago
- Views:
Transcription
1 A hands-on training session on Computing with MATLAB in connection with the FDP on Electronic Design GCE Kannur 11 th 15 th December 2017 Resource Person : Dr. A. Ranjith Ram Associate Professor, ECE Dept. Govt. College of Engineering Kannur Cell : arr@gcek.ac.in Objective : Creating functions, 2-D, and 3-D plots 48 Slides & 90 Minutes Outline Logical operations & Logical indexing Cell arrays The for loop, while, if-else, break etc. Commenting and publishing MATLAB script files Standard AM and FM Simulation, computing the execution time Developing user-defined functions Global variables, current directory & path Plotting 2-D and 3-D figures in MATLAB 2 Dr. A. Ranjith Ram arr@gcek.ac.in 1
2 Logical & Relational Operators 20 Minutes Relational Operators Equals : == or eq Greater than : > or gt Less than : < and lt Greater than or equal : >= or ge Less than or equal : <= or le Not equal : ~= or ne Whether numerically equal : isequal 4 Dr. A. Ranjith Ram arr@gcek.ac.in 2
3 Logical Operations and : & not : ~ or : exor : xor Determine if all array elements are nonzero : all Determine if any array elements are nonzero : any Find indices and values of nonzero elements : find Determine if input is logical array : islogical 5 Logical Indexing One can use logical indexing to extract portions of data according to a logical criterion. Comparisons using relational operators such as < and == return a logical array. Eg., marks = [ ]; idx = marks >= 35; creates a logical variable idx of the same size as marks One can use a logical variable as an index to any other variable The result will be the array elements where the index is true passed = marks(idx); Note that the result of logical indexing will be a smaller array (possibly even empty if the index contains no true values). It is therefore important to be careful to keep dimensions consistent when indexing to multiple variables. 6 Dr. A. Ranjith Ram arr@gcek.ac.in 3
4 Cell Arrays Cell arrays are a MATLAB data type that can contain data of different types and dimensions. Each cell in a cell array contains data in the form of any possible MATLAB data type, including other cell arrays. The contents of the cells in cell array need not be of the same size, dimensions or even type. For example, in a 2-element cell array data, the content of the first cell can be another cell array and that of the second cell be a numeric array Cell arrays are very powerful in coping with data using MATLAB, in the sense it greatly simplifies processing using structured data features. 7 Cell Array Indexing We can index a cell array using standard MATLAB indexing. This returns a portion of the original cell array, and so, itself a cell array. data(1) returns the first cell of the cell array data MATLAB will display only the data type and size of the cell, not its contents We can access the contents of cells in a cell array by indexing with curly braces { } rather than parentheses. name = data{2} assigns the contents of the first cell of the cell array data to name What will be the outputs of data(1:4) and data{1:4}? >> data{1:4} is equivalent to >> data{1}, data{2}, data{3}, data{4} 8 Dr. A. Ranjith Ram arr@gcek.ac.in 4
5 Cell Array Indexing (Contd..) >> data = {12 2 1;'Sachin a<1 20 ;23 a>=1 'Sharukh'} Try name1 = data{2,1} name2 = data(2,1) data1 = data{1:3} data2 = data(1:3) row1 = data{1,1:3} row2 = data(1,1:3) 9 Iterative Constructs 30 Minutes Dr. A. Ranjith Ram arr@gcek.ac.in 5
6 The for Loop for i=1:1:10 pow = i*i end for should always be closed with end for nested for loops, there should be sufficient number of end s for i=1:1:20 for j=1:1:10 prod = i*j end end Default increment of the index is unity The drawback of using for loops in MATLAB is the computational delay 11 While Performs a group of operations when a condition is satisfied a = 1 while length(a) < 10 a = [0 a] + [a 0] end produces the Pascal s Triangle : Dr. A. Ranjith Ram arr@gcek.ac.in 6
7 if - else if else also should be closed with end if expression statements else if expression statements else statements end for i=0:1:10 if rem(i,2) ~= 0 odd = i else even = i end end 13 Break & Continue break terminates the execution of a for or while loop. Statements in the loop after the break statement do not execute. In nested loops, break exits only from the loop in which it occurs. Control passes to the statement that follows the end of that loop. continue passes control to the next iteration of a for or while loop. It skips any remaining statements in the body of the loop for the current iteration. The program continues execution from the next iteration. continue applies only to the body of the loop where it is called. In nested loops, continue skips remaining statements only in the body of the loop in which it occurs 14 Dr. A. Ranjith Ram arr@gcek.ac.in 7
8 Commenting & Publishing 50 Minutes Making the Script User-friendly By inserting comments at appropriate positions in the script Commenting in MATLAB is by putting % There is no need to enclose the comment inside two % s All the text portion to the right side of a % until a line feed will be treated as a comment The commented portion would be automatically displayed in green fonts in the MATLAB editor The process of commenting not only for making the script user-friendly, but also to serve for additional features on publishing the script. 16 Dr. A. Ranjith Ram arr@gcek.ac.in 8
9 Standard AM An example MATLAB program Equation : v(t) = V c [1 + k a v m (t)] cos (2πf c t) Single tone : v(t) = V c [1 + m.cos (2πf m t) ] cos (2πf c t) f1 = 2; f2 = 80; fs = 10000; t = 0:(1/fs):1; m = 0.8; vm = cos(2*pi*f1*t); vc = cos(2*pi*f2*t); sam = (1+m*vm).*vc; plot(t,sam) % Baseband frequency % Carrier frequency % Sampling Rate % Sampling instants % Modulation Index % Baseband Signal % Carrier Signal % Standard AM 17 Standard AM Spectra & Complete Waveforms Spectra computation in MATLAB : fft X = fft(sam,fs); % N-point Spectra subplot(411); plot(t,vm); subplot(412); plot(t,vc, r ); subplot(413); plot(t,sam, g ); subplot(414); stem([1:fs]-1,abs(x), k ); axis([ ]); 18 Dr. A. Ranjith Ram arr@gcek.ac.in 9
10 FM Another example program Equation : v = V cos (ω c t + m f sin ω m t) f1 = 2; % Baseband frequency f2 = 80; % Carrier frequency fs = 10000; t = 0:(1/fs):1; % Sampling instants m = 4; % Modulation Index vm = sin(2*pi*f1*t); % Baseband Signal vc = cos(2*pi*f2*t); % Carrier Signal fm = cos(2*pi*f2*t + m*vm); % FM plot(t,fm) (Find spectra and plot all waveforms and spectra using subplot) 19 Publishing a MATLAB script Publishing : 20 Dr. A. Ranjith Ram arr@gcek.ac.in 10
11 Publishing Options Output file format Appropriate placing of %% effects the generation of section titles and table of content in the published file. 21 Repeating % has Meaning! Only error-free codes can be published This is because MATLAB always runs the codes before publishing A double % comment in the top means the title in publishing! A single % comment after this will be published as text lines in the document Subsequent double % effects the table of content & section headings! Comments in line with the commands will be maintained as such in the document The figures will be inserted soon after the codes for plotting. 22 Dr. A. Ranjith Ram arr@gcek.ac.in 11
12 Tea Break! 10 Minutes Creating Functions 40 Minutes Dr. A. Ranjith Ram 12
13 Creating User-defined Functions One can modularize the code by creating his/her own functions in MATLAB A main script file may call these functions by passing appropriate arguments to them. All the concepts like arguments, local and global variables etc., concerned with C programming is applicable here also. Hence at the function call, arguments are passed to the function The function performs the necessary computation and returns values to the calling program The returned values are used in the main script 25 Form of MATLAB Functions The first command line should be of the form function [v1 v2] = funct_name(a1, a2,..., an) v1 & v2 return values funct_name name given to the function (Should not be a built-in function) a1, a2,..., an arguments passed Care should be taken : The script file itself should be named with funct_name.m and it should reside in the current directory Then one can use the user-defined function, func_name by typing [p q] = func_name(i, j, l,... n) 26 Dr. A. Ranjith Ram arr@gcek.ac.in 13
14 Current Directory Current Directory 27 An Example Function function v = sam(t,f1,f2,m) % Function definition vm = cos(2*pi*f1*t); % Baseband Signal vc = cos(2*pi*f2*t); % Carrier Signal v = (1+m*vm).*vc; % Standard AM Main Program : time = 0:0.001:1; % Time duration bf = 2; % Baseband frequency cf = 80; % Carrier frequency mi = 0.8; % Modulation Index x = sam(time,bf,cf,mi); % Function Call plot(time,x) % Plot AM 28 Dr. A. Ranjith Ram arr@gcek.ac.in 14
15 Local & Global Variables function g = game(p,q,r,s) global a b; % global variables t=p*q/a; u=r*s/b; g = t.^2 + u.^2; % return value If not defined as global, all the variables are local to the function Interestingly, one can note that the local variables will not be displayed in the workspace Unlike C, the functions are not to be written in the same file as the main program A function can also be passed as an argument to another function In this is to be used as the argument 29 More about MATLAB functions If the function is not in the current directory, one can Set Path for calling the function The comments inserted in the beginning of MATLAB function script bear additional information than simple comment lines They serve as the information to be displayed on the screen when the user seeks help First few lines of comments until two line breaks will be thrown for display on help This is how comment lines are placed in a MATLAB function 30 Dr. A. Ranjith Ram arr@gcek.ac.in 15
16 Setting Path Setting a path 31 Setting Path (Contd..) Saving the set path will permanently add the new folder to MATLAB software! By this you can add your own toolboxes to MATLAB, i.e., you can customize it. 32 Dr. A. Ranjith Ram arr@gcek.ac.in 16
17 Commenting in the Function % SAM computes the standard am function % sam(a,b,c,d) returns the standard am samples in % which a is the time span, b is the baseband % frequency, c is the carrier frequency and d is the % modulation index in the range (0,1) % Developed by Ranjith Ram on 18 th August function v = sam(t,f1,f2,m) % Function Definition vm = cos(2*pi*f1*t); % Baseband Signal vc = cos(2*pi*f2*t); % Carrier Signal v = (1+m*vm).*vc; % Standard AM 33 The Execution Time Avoid using for loops as much as possible since it consumes time. If logical indexing is used, the code becomes faster! tic & toc functions work together to measure elapsed time. toc, by itself, displays the elapsed time, in seconds, since the most recent execution of the tic command. T = toc saves the elapsed time in T as a double scalar. toc(tstart) measures the time elapsed since the tic command that generated TSTART. Example code is >> tic >> E = sum(abs(x).^2)/8; >> toc 34 Dr. A. Ranjith Ram arr@gcek.ac.in 17
18 Deliberate Delay Pause One can deliberately delay the computation by inserting a pause command in MATLAB pause(n) pauses for n seconds before continuing, where n can also be a fraction. For example, pause(2) delays the execution of the next command by 2 seconds A simple pause without any argument causes a procedure to stop and wait for the user to strike any key before continuing. Example code is >> tic >> E = sum(abs(x).^2)/8; >> pause(2) >> toc 35 2-D & 3-D Visualizations 60 Minutes Dr. A. Ranjith Ram arr@gcek.ac.in 18
19 2-D and 3-D plots in MATLAB One can have higher dimensional plots in MATLAB using appropriate functions For this, the first task is to select the two dimensional data points The corresponding task in 1-D case was achieved by using t = 1 : 200 or t = linspace(1,200,200) Here t would serve as the index for the placement of 1-D samples In 2-D, an extended spatial arrangement is required to initialize a plot The MATLAB function meshgrid will serve this purpose 37 Making data points for 2-D plots The meshgrid function converts vectors of points into matrices that can represent a grid of points in the x-y plane >> x = 1:7; >> y = 2:2:12; >> [X,Y] = meshgrid(x,y); x : 1 x 7 vector y : 1 x 6 vector Grid is formed with 6 x 7 points Here X contains the x coordinates of all points in the 6-by-7 grid and Y contains the corresponding y coordinates. These matrices of coordinates can be used in calculations, interpolation of scattered data and visualization. 38 Dr. A. Ranjith Ram arr@gcek.ac.in 19
20 Mesh Grid (1,2) (4,2) (7,2) (1,8) (7,8) (1,12) (4,12) (7,12) 39 Two Dimensional Plots contour(z) plot of matrix z treating the values in z as heights above a plane are the level curves of z for some values v. The values v are chosen automatically contour(x, y, z) x and y specify the (x, y) coordinates of the surface fill(x, y, c) fills the 2-D polygon defined by vectors x and y with the color specified by c The vertices of the polygon are specified by pairs of components of x and y c is a single character string chosen from the list 'r', 'g', 'b', 'c', 'm', 'y', 'w', 'k'. 40 Dr. A. Ranjith Ram arr@gcek.ac.in 20
21 2-D Plot Example contour [x y] = meshgrid(-3:0.1:+3, -3:0.1:+3); contour(x,y,x.^2 + y.^2); axis square This yields an output figure : Three Dimensional Plots plot3(x, y, z) if x, y, and z are vectors, it plots a line in 3D space through the points whose coordinates are the elements of x, y and z. if x, y, and z are matrices, it plots several lines obtained from the columns of x, y and z. contour3(x, y, z) 3D contour plot mesh(x, y, z) plots the colored parametric mesh defined by the arguments surf(x, y, z) plots the colored parametric surface defined by the arguments colour is proportional to the height of the surface 42 Dr. A. Ranjith Ram arr@gcek.ac.in 21
22 3-D Plot Example plot3 t=-2:0.01:2; Plot3(cos(2*pi*t),sin(2*pi*t),t); This yields an output figure : D Plot Example mesh [x y] = meshgrid(-2:0.1:2,-2:0.1:2); z = x.^2 - y.^2; Saddle Point mesh(x,y,z); 4 2 Z 0 This yields an output figure : Y X Dr. A. Ranjith Ram arr@gcek.ac.in 22
23 3-D Plot Example surf [z theta] = meshgrid(-1:0.1:1, (0:0.1:2)*pi); x=sqrt(1-z.^2).*cos(theta); 1 y=sqrt(1-z.^2).*sin(theta); 0.5 surf(x,y,z); axis square -1 1 This yields an output figure : Graphics Objects & Properties A plot in MATLAB is a collection of there graphics objects : 1. a figure window 2. axes 3. plot elements (such as lines and bars) The commands are >> figure; >> axes; >> plot(t,x); Each graphics object has properties that govern its appearance and behavior. Different types of objects have different properties, although there are some properties that are universal. One can interact with graphics object by obtaining a handle to it. 46 Dr. A. Ranjith Ram arr@gcek.ac.in 23
24 Graphics Object Hierarchy The axes labels and title are described by text objects that are a part of the axes, their handles being stored in the X/Y/Zlabels and Title properties of the axes object, rather than as children Figure = Axes Plot objects 47 Part II : Summary Studied logical operations and logical indexing Familiarized with cell arrays, for and while loops and if-else construct Learnt how to make the code user-friendly through commenting Studied how to publish a MATLAB script Simulated AM and FM, computed the execution time Studied how to create user-defined functions Earned the notion of global variables, current directory & path Learnt how to plot 2-D and 3-D figures in MATLAB 48 Dr. A. Ranjith Ram arr@gcek.ac.in 24
25 Thanks Courtesy : 1. MathWorks Training & Services, Bengaluru 2. TEQIP Project Phase-II, GCE Kannur arr@gcek.ac.in Mob : Dr. A. Ranjith Ram arr@gcek.ac.in 25
FDP on Electronic Design Tools - Fundamentals of MATLAB 12/12/2017. A hands-on training session on. Fundamentals of MATLAB
A hands-on training session on Fundamentals of MATLAB in connection with the FDP on Electronic Design Tools @ GCE Kannur 11 th 15 th December 2017 Resource Person : Dr. A. Ranjith Ram Associate Professor,
More informationFDP on Electronic Design Tools Matlab for Control System Modeling 13/12/2017. A hands-on training session on
A hands-on training session on MATLAB for Control System Modeling in connection with the FDP on Electronic Design Tools @ GCE Kannur 11 15 December 2017 Resource Person : Dr. A. Ranjith Ram Associate Professor,
More informationMechanical Engineering Department Second Year (2015)
Lecture 7: Graphs Basic Plotting MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. This section describes a few of the most
More informationAppendix A. Introduction to MATLAB. A.1 What Is MATLAB?
Appendix A Introduction to MATLAB A.1 What Is MATLAB? MATLAB is a technical computing environment developed by The Math- Works, Inc. for computation and data visualization. It is both an interactive system
More informationMath Sciences Computing Center. University ofwashington. September, Fundamentals Making Plots Printing and Saving Graphs...
Introduction to Plotting with Matlab Math Sciences Computing Center University ofwashington September, 1996 Contents Fundamentals........................................... 1 Making Plots...........................................
More informationConstraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial
1 Matlab Tutorial 2 Lecture Learning Objectives Each student should be able to: Describe the Matlab desktop Explain the basic use of Matlab variables Explain the basic use of Matlab scripts Explain the
More informationECE 202 LAB 3 ADVANCED MATLAB
Version 1.2 1 of 13 BEFORE YOU BEGIN PREREQUISITE LABS ECE 201 Labs EXPECTED KNOWLEDGE ECE 202 LAB 3 ADVANCED MATLAB Understanding of the Laplace transform and transfer functions EQUIPMENT Intel PC with
More informationUNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER BENC 2113 DENC ECADD 2532 ECADD LAB SESSION 6/7 LAB
More informationINTERNATIONAL EDITION. MATLAB for Engineers. Third Edition. Holly Moore
INTERNATIONAL EDITION MATLAB for Engineers Third Edition Holly Moore 5.4 Three-Dimensional Plotting Figure 5.8 Simple mesh created with a single two-dimensional matrix. 5 5 Element,5 5 The code mesh(z)
More informationMATH 2221A Mathematics Laboratory II
MATH A Mathematics Laboratory II Lab Assignment 4 Name: Student ID.: In this assignment, you are asked to run MATLAB demos to see MATLAB at work. The color version of this assignment can be found in your
More informationLab 6: Graphical Methods
Lab 6: Graphical Methods 6.1 Introduction EGR 53L - Fall 2009 Lab this week is going to introduce graphical solution and presentation techniques as well as surface plots. 6.2 Resources The additional resources
More informationMatlab programming, plotting and data handling
Matlab programming, plotting and data handling Andreas C. Kapourani (Credit: Steve Renals & Iain Murray) 25 January 27 Introduction In this lab session, we will continue with some more sophisticated matrix
More informationIntroduction to Matlab. By: Hossein Hamooni Fall 2014
Introduction to Matlab By: Hossein Hamooni Fall 2014 Why Matlab? Data analytics task Large data processing Multi-platform, Multi Format data importing Graphing Modeling Lots of built-in functions for rapid
More informationA Guide to Using Some Basic MATLAB Functions
A Guide to Using Some Basic MATLAB Functions UNC Charlotte Robert W. Cox This document provides a brief overview of some of the essential MATLAB functionality. More thorough descriptions are available
More informationMATLAB Laboratory 09/23/10 Lecture. Chapters 5 and 9: Plotting
MATLAB Laboratory 09/23/10 Lecture Chapters 5 and 9: Plotting Lisa A. Oberbroeckling Loyola University Maryland loberbroeckling@loyola.edu L. Oberbroeckling (Loyola University) MATLAB 09/23/10 Lecture
More informationMATLAB basic guide to create 2D and 3D Plots. Part I Introduction
MATLAB basic guide to create 2D and 3D Plots Part I Introduction This guide will walk you through the steps necessary to create, using MATLAB, a Three dimensional surface, a Two dimensional contour plot
More informationLab of COMP 406 Introduction of Matlab (II) Graphics and Visualization
Lab of COMP 406 Introduction of Matlab (II) Graphics and Visualization Teaching Assistant: Pei-Yuan Zhou Contact: cspyzhou@comp.polyu.edu.hk Lab 2: 19 Sep., 2014 1 Review Find the Matlab under the folder
More informationMATLAB Tutorial. Primary Author: Shoumik Chatterjee Secondary Author: Dr. Chuan Li
MATLAB Tutorial Primary Author: Shoumik Chatterjee Secondary Author: Dr. Chuan Li 1 Table of Contents Section 1: Accessing MATLAB using RamCloud server...3 Section 2: MATLAB GUI Basics. 6 Section 3: MATLAB
More informationIntroduction to Matlab
Introduction to Matlab By:Mohammad Sadeghi *Dr. Sajid Gul Khawaja Slides has been used partially to prepare this presentation Outline: What is Matlab? Matlab Screen Basic functions Variables, matrix, indexing
More informationPlotting - Practice session
Plotting - Practice session Alessandro Fanfarillo - Salvatore Filippone fanfarillo@ing.uniroma2.it May 28th, 2013 (fanfarillo@ing.uniroma2.it) Plotting May 28th, 2013 1 / 14 Plot function The basic function
More informationPage 1 of 7 E7 Spring 2009 Midterm I SID: UNIVERSITY OF CALIFORNIA, BERKELEY Department of Civil and Environmental Engineering. Practice Midterm 01
Page 1 of E Spring Midterm I SID: UNIVERSITY OF CALIFORNIA, BERKELEY Practice Midterm 1 minutes pts Question Points Grade 1 4 3 6 4 16 6 1 Total Notes (a) Write your name and your SID on the top right
More informationINTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX
INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX 1) Objective The objective of this lab is to review how to access Matlab, Simulink, and the Communications Toolbox, and to become familiar
More informationClasses 7-8 (4 hours). Graphics in Matlab.
Classes 7-8 (4 hours). Graphics in Matlab. Graphics objects are displayed in a special window that opens with the command figure. At the same time, multiple windows can be opened, each one assigned a number.
More informationIntroduction to Matlab. By: Dr. Maher O. EL-Ghossain
Introduction to Matlab By: Dr. Maher O. EL-Ghossain Outline: q What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control
More informationExperiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?
Experiment 1: Introduction to MATLAB I Introduction MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing numerical and symbolic calculations, and is widely used in science
More informationLogical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression.
What is the answer? >> Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression. The finite(x)is true for all finite numerical
More informationComputing Fundamentals Plotting
Computing Fundamentals Plotting Salvatore Filippone salvatore.filippone@uniroma2.it 2014 2015 (salvatore.filippone@uniroma2.it) Plotting 2014 2015 1 / 14 Plot function The basic function to plot something
More informationIntroduction to Programming in MATLAB
Introduction to Programming in MATLAB User-defined Functions Functions look exactly like scripts, but for ONE difference Functions must have a function declaration Help file Function declaration Outputs
More informationMatlab Practice Sessions
Matlab Practice Sessions 1. Getting Started Startup Matlab Observe the following elements of the desktop; Command Window Current Folder Window Command History Window Workspace Window Notes: If you startup
More informationPROGRAMMING WITH MATLAB WEEK 6
PROGRAMMING WITH MATLAB WEEK 6 Plot: Syntax: plot(x, y, r.- ) Color Marker Linestyle The line color, marker style and line style can be changed by adding a string argument. to select and delete lines
More informationIntroduction to PartSim and Matlab
NDSU Introduction to PartSim and Matlab pg 1 PartSim: www.partsim.com Introduction to PartSim and Matlab PartSim is a free on-line circuit simulator that we use in Circuits and Electronics. It works fairly
More informationENGG1811 Computing for Engineers Week 11 Part C Matlab: 2D and 3D plots
ENGG1811 Computing for Engineers Week 11 Part C Matlab: 2D and 3D plots ENGG1811 UNSW, CRICOS Provider No: 00098G1 W11 slide 1 More on plotting Matlab has a lot of plotting features Won t go through them
More informationMatlab Tutorial. The value assigned to a variable can be checked by simply typing in the variable name:
1 Matlab Tutorial 1- What is Matlab? Matlab is a powerful tool for almost any kind of mathematical application. It enables one to develop programs with a high degree of functionality. The user can write
More informationINTRODUCTION TO MATLAB PLOTTING WITH MATLAB
1 INTRODUCTION TO MATLAB PLOTTING WITH MATLAB Plotting with MATLAB x-y plot Plotting with MATLAB MATLAB contains many powerful functions for easily creating plots of several different types. Command plot(x,y)
More informationIntroduction to Matlab. Summer School CEA-EDF-INRIA 2011 of Numerical Analysis
Introduction to Matlab 1 Outline What is Matlab? Matlab desktop & interface Scalar variables Vectors and matrices Exercise 1 Booleans Control structures File organization User defined functions Exercise
More informationIntroduction to MATLAB
Computational Photonics, Seminar 0 on Introduction into MATLAB, 3.04.08 Page Introduction to MATLAB Operations on scalar variables >> 6 6 Pay attention to the output in the command window >> b = b = >>
More informationEric W. Hansen. The basic data type is a matrix This is the basic paradigm for computation with MATLAB, and the key to its power. Here s an example:
Using MATLAB for Stochastic Simulation. Eric W. Hansen. Matlab Basics Introduction MATLAB (MATrix LABoratory) is a software package designed for efficient, reliable numerical computing. Using MATLAB greatly
More informationMATLAB Tutorial EE351M DSP. Created: Thursday Jan 25, 2007 Rayyan Jaber. Modified by: Kitaek Bae. Outline
MATLAB Tutorial EE351M DSP Created: Thursday Jan 25, 2007 Rayyan Jaber Modified by: Kitaek Bae Outline Part I: Introduction and Overview Part II: Matrix manipulations and common functions Part III: Plots
More informationGRAPHICS AND VISUALISATION WITH MATLAB
GRAPHICS AND VISUALISATION WITH MATLAB UNIVERSITY OF SHEFFIELD CiCS DEPARTMENT Des Ryan & Mike Griffiths September 2017 Topics 2D Graphics 3D Graphics Displaying Bit-Mapped Images Graphics with Matlab
More informationBasic Simulation Lab with MATLAB
Chapter 3: Generation of Signals and Sequences 1. t = 0 : 0.001 : 1; Generate a vector of 1001 samples for t with a value between 0 & 1 with an increment of 0.001 2. y = 0.5 * t; Generate a linear ramp
More informationStokes Modelling Workshop
Stokes Modelling Workshop 14/06/2016 Introduction to Matlab www.maths.nuigalway.ie/modellingworkshop16/files 14/06/2016 Stokes Modelling Workshop Introduction to Matlab 1 / 16 Matlab As part of this crash
More informationEE 301 Lab 1 Introduction to MATLAB
EE 301 Lab 1 Introduction to MATLAB 1 Introduction In this lab you will be introduced to MATLAB and its features and functions that are pertinent to EE 301. This lab is written with the assumption that
More informationIntroduction to Matlab
NDSU Introduction to Matlab pg 1 Becoming familiar with MATLAB The console The editor The graphics windows The help menu Saving your data (diary) Solving N equations with N unknowns Least Squares Curve
More informationIntroduction to MATLAB: Graphics
Introduction to MATLAB: Graphics Eduardo Rossi University of Pavia erossi@eco.unipv.it September 2014 Rossi Introduction to MATLAB Financial Econometrics - 2014 1 / 14 2-D Plot The command plot provides
More informationProf. Manoochehr Shirzaei. RaTlab.asu.edu
RaTlab.asu.edu Introduction To MATLAB Introduction To MATLAB This lecture is an introduction of the basic MATLAB commands. We learn; Functions Procedures for naming and saving the user generated files
More informationIntroduction to MATLAB
Introduction to MATLAB 1 Introduction to MATLAB A Tutorial for the Course Computational Intelligence http://www.igi.tugraz.at/lehre/ci Stefan Häusler Institute for Theoretical Computer Science Inffeldgasse
More informationIntroduction to MATLAB Practical 1
Introduction to MATLAB Practical 1 Daniel Carrera November 2016 1 Introduction I believe that the best way to learn Matlab is hands on, and I tried to design this practical that way. I assume no prior
More informationIntroduction to Matlab
Introduction to Matlab Roger Hansen (rh@fys.uio.no) PGP, University of Oslo September 2004 Introduction to Matlab p.1/22 Contents Programming Philosophy What is Matlab? Example: Linear algebra Example:
More informationMATLAB 1. Jeff Freymueller September 24, 2009
MATLAB 1 Jeff Freymueller September 24, 2009 MATLAB IDE MATLAB Edi?ng Window We don t need no steenkin GUI You can also use MATLAB without the fancy user interface, just a command window. Why? You can
More informationWhat is Matlab? A software environment for interactive numerical computations
What is Matlab? A software environment for interactive numerical computations Examples: Matrix computations and linear algebra Solving nonlinear equations Numerical solution of differential equations Mathematical
More informationMAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB
MATLAB sessions: Laboratory MAT 75 Laboratory Matrix Computations and Programming in MATLAB In this laboratory session we will learn how to. Create and manipulate matrices and vectors.. Write simple programs
More informationA very brief Matlab introduction
A very brief Matlab introduction Siniša Krajnović January 24, 2006 This is a very brief introduction to Matlab and its purpose is only to introduce students of the CFD course into Matlab. After reading
More informationENGR 1181 MATLAB 09: For Loops 2
ENGR 1181 MATLAB 09: For Loops Learning Objectives 1. Use more complex ways of setting the loop index. Construct nested loops in the following situations: a. For use with two dimensional arrays b. For
More informationStarting Matlab. MATLAB Laboratory 09/09/10 Lecture. Command Window. Drives/Directories. Go to.
Starting Matlab Go to MATLAB Laboratory 09/09/10 Lecture Lisa A. Oberbroeckling Loyola University Maryland loberbroeckling@loyola.edu http://ctx.loyola.edu and login with your Loyola name and password...
More informationMATLAB Tutorial. Mohammad Motamed 1. August 28, generates a 3 3 matrix.
MATLAB Tutorial 1 1 Department of Mathematics and Statistics, The University of New Mexico, Albuquerque, NM 87131 August 28, 2016 Contents: 1. Scalars, Vectors, Matrices... 1 2. Built-in variables, functions,
More informationFunctions of Two Variables
Functions of Two Variables MATLAB allows us to work with functions of more than one variable With MATLAB 5 we can even move beyond the traditional M N matrix to matrices with an arbitrary number of dimensions
More informationTable of Contents. Introduction.*.. 7. Part /: Getting Started With MATLAB 5. Chapter 1: Introducing MATLAB and Its Many Uses 7
MATLAB Table of Contents Introduction.*.. 7 About This Book 1 Foolish Assumptions 2 Icons Used in This Book 3 Beyond the Book 3 Where to Go from Here 4 Part /: Getting Started With MATLAB 5 Chapter 1:
More informationMATLAB Guide to Fibonacci Numbers
MATLAB Guide to Fibonacci Numbers and the Golden Ratio A Simplified Approach Peter I. Kattan Petra Books www.petrabooks.com Peter I. Kattan, PhD Correspondence about this book may be sent to the author
More informationIntroduction to MATLAB
Introduction to MATLAB Zhiyu Zhao (sylvia@cs.uno.edu) The LONI Institute & Department of Computer Science College of Sciences University of New Orleans 03/02/2009 Outline What is MATLAB Getting Started
More informationIntroduction to MATLAB for Engineers, Third Edition
PowerPoint to accompany Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2010. The McGraw-Hill Companies, Inc. This work is
More informationIntroduction to MATLAB. Computational Probability and Statistics CIS 2033 Section 003
Introduction to MATLAB Computational Probability and Statistics CIS 2033 Section 003 About MATLAB MATLAB (MATrix LABoratory) is a high level language made for: Numerical Computation (Technical computing)
More informationFinding MATLAB on CAEDM Computers
Lab #1: Introduction to MATLAB Due Tuesday 5/7 at noon This guide is intended to help you start, set up and understand the formatting of MATLAB before beginning to code. For a detailed guide to programming
More informationIntroduction to MATLAB
Chapter 1 Introduction to MATLAB 1.1 Software Philosophy Matrix-based numeric computation MATrix LABoratory built-in support for standard matrix and vector operations High-level programming language Programming
More informationIntroduction to MATLAB
ELG 3125 - Lab 1 Introduction to MATLAB TA: Chao Wang (cwang103@site.uottawa.ca) 2008 Fall ELG 3125 Signal and System Analysis P. 1 Do You Speak MATLAB? MATLAB - The Language of Technical Computing ELG
More informationIntroduction to Matlab
Introduction to Matlab This tour introduces the basic notions of programming with Matlab. Contents M-file scripts M-file functions Inline functions Loops Conditionals References M-file scripts A script
More informationMatlab Tutorial. Get familiar with MATLAB by using tutorials and demos found in MATLAB. You can click Start MATLAB Demos to start the help screen.
University of Illinois at Urbana-Champaign Department of Electrical and Computer Engineering ECE 298JA Fall 2015 Matlab Tutorial 1 Overview The goal of this tutorial is to help you get familiar with MATLAB
More informationWriting MATLAB Programs
Outlines September 14, 2004 Outlines Part I: Review of Previous Lecture Part II: Review of Previous Lecture Outlines Part I: Review of Previous Lecture Part II: Control Structures If/Then/Else For Loops
More informationIntroduction to MATLAB programming: Fundamentals
Introduction to MATLAB programming: Fundamentals Shan He School for Computational Science University of Birmingham Module 06-23836: Computational Modelling with MATLAB Outline Outline of Topics Why MATLAB?
More informationIntroduction to Matlab
Technische Universität München WT 21/11 Institut für Informatik Prof Dr H-J Bungartz Dipl-Tech Math S Schraufstetter Benjamin Peherstorfer, MSc October 22nd, 21 Introduction to Matlab Engineering Informatics
More informationMATLAB Project: Getting Started with MATLAB
Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos, sin,
More informationECE Lesson Plan - Class 1 Fall, 2001
ECE 201 - Lesson Plan - Class 1 Fall, 2001 Software Development Philosophy Matrix-based numeric computation - MATrix LABoratory High-level programming language - Programming data type specification not
More informationW1005 Intro to CS and Programming in MATLAB. Plo9ng & Visualiza?on. Fall 2014 Instructor: Ilia Vovsha. hgp://www.cs.columbia.
W1005 Intro to CS and Programming in MATLAB Plo9ng & Visualiza?on Fall 2014 Instructor: Ilia Vovsha hgp://www.cs.columbia.edu/~vovsha/w1005 Outline Plots (2D) Plot proper?es Figures Plots (3D) 2 2D Plots
More informationIntroduction to MATLAB
Introduction to MATLAB Introduction MATLAB is an interactive package for numerical analysis, matrix computation, control system design, and linear system analysis and design available on most CAEN platforms
More information3 An Introductory Demonstration Execute the following command to view a quick introduction to Matlab. >> intro (Use your mouse to position windows on
Department of Electrical Engineering EE281 Introduction to MATLAB on the Region IV Computing Facilities 1 What is Matlab? Matlab is a high-performance interactive software package for scientic and enginnering
More informationScilab Programming. The open source platform for numerical computation. Satish Annigeri Ph.D.
Scilab Programming The open source platform for numerical computation Satish Annigeri Ph.D. Professor, Civil Engineering Department B.V.B. College of Engineering & Technology Hubli 580 031 satish@bvb.edu
More informationLAB 1: Introduction to MATLAB Summer 2011
University of Illinois at Urbana-Champaign Department of Electrical and Computer Engineering ECE 311: Digital Signal Processing Lab Chandra Radhakrishnan Peter Kairouz LAB 1: Introduction to MATLAB Summer
More informationNo, not unless you specify in MATLAB which folder directory to look for it in, which is outside of the scope of this course.
ENGR 1181 Midterm 2 Review Worksheet SOLUTIONS Note: This practice material does not contain actual test questions or represent the format of the midterm. The first 29 questions should be completed WITHOUT
More informationIntroduction to Matlab to Accompany Linear Algebra. Douglas Hundley Department of Mathematics and Statistics Whitman College
Introduction to Matlab to Accompany Linear Algebra Douglas Hundley Department of Mathematics and Statistics Whitman College August 27, 2018 2 Contents 1 Getting Started 5 1.1 Before We Begin........................................
More informationPractical 4: The Integrate & Fire neuron
Practical 4: The Integrate & Fire neuron 2014 version by Mark van Rossum 2018 version by Matthias Hennig and Theoklitos Amvrosiadis 16th October 2018 1 Introduction to MATLAB basics You can start MATLAB
More informationIntroduction to MATLAB LAB 1
Introduction to MATLAB LAB 1 1 Basics of MATLAB MATrix LABoratory A super-powerful graphing calculator Matrix based numeric computation Embedded Functions Also a programming language User defined functions
More informationMATLAB/Octave Tutorial
University of Illinois at Urbana-Champaign Department of Electrical and Computer Engineering ECE 298JA Fall 2017 MATLAB/Octave Tutorial 1 Overview The goal of this tutorial is to help you get familiar
More informationLaboratory 1 Octave Tutorial
Signals, Spectra and Signal Processing Laboratory 1 Octave Tutorial 1.1 Introduction The purpose of this lab 1 is to become familiar with the GNU Octave 2 software environment. 1.2 Octave Review All laboratory
More informationIntroduction to Matlab
Introduction to Matlab Enrique Muñoz Ballester Dipartimento di Informatica via Bramante 65, 26013 Crema (CR), Italy enrique.munoz@unimi.it Contact Email: enrique.munoz@unimi.it Office: Room BT-43 Industrial,
More informationfunction [s p] = sumprod (f, g)
Outline of the Lecture Introduction to M-function programming Matlab Programming Example Relational operators Logical Operators Matlab Flow control structures Introduction to M-function programming M-files:
More informationMacro Programming Reference Guide. Copyright 2005 Scott Martinez
Macro Programming Reference Guide Copyright 2005 Scott Martinez Section 1. Section 2. Section 3. Section 4. Section 5. Section 6. Section 7. What is macro programming What are Variables What are Expressions
More informationIntroduction to Matlab
Introduction to Matlab Andreas C. Kapourani (Credit: Steve Renals & Iain Murray) 9 January 08 Introduction MATLAB is a programming language that grew out of the need to process matrices. It is used extensively
More informationDSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab
Islamic University of Gaza Faculty of Engineering Electrical Engineering Department 2012 DSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab Goals for this Lab Assignment: In this lab we would have
More informationEL2310 Scientific Programming LAB1: MATLAB lab session. Patric Jensfelt
EL2310 Scientific Programming LAB1: MATLAB lab session Patric Jensfelt Chapter 1 Introduction 1.1 Goals for this lab The goals for this lab is handle the computers in the computer rooms create and edit
More informationMATLAB 7 Getting Started Guide
MATLAB 7 Getting Started Guide How to Contact The MathWorks www.mathworks.com Web comp.soft-sys.matlab Newsgroup www.mathworks.com/contact_ts.html Technical Support suggest@mathworks.com bugs@mathworks.com
More informationDesktop Command window
Chapter 1 Matlab Overview EGR1302 Desktop Command window Current Directory window Tb Tabs to toggle between Current Directory & Workspace Windows Command History window 1 Desktop Default appearance Command
More information1 Introduction to Matlab
1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,
More informationMATLAB Basics EE107: COMMUNICATION SYSTEMS HUSSAIN ELKOTBY
MATLAB Basics EE107: COMMUNICATION SYSTEMS HUSSAIN ELKOTBY What is MATLAB? MATLAB (MATrix LABoratory) developed by The Mathworks, Inc. (http://www.mathworks.com) Key Features: High-level language for numerical
More informationA/D Converter. Sampling. Figure 1.1: Block Diagram of a DSP System
CHAPTER 1 INTRODUCTION Digital signal processing (DSP) technology has expanded at a rapid rate to include such diverse applications as CDs, DVDs, MP3 players, ipods, digital cameras, digital light processing
More informationMATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks
MATLAB Basics Stanley Liang, PhD York University Configure a MATLAB Package Get a MATLAB Student License on Matworks Visit MathWorks at https://www.mathworks.com/ It is recommended signing up with a student
More informationComputational Modelling 102 (Scientific Programming) Tutorials
COMO 102 : Scientific Programming, Tutorials 2003 1 Computational Modelling 102 (Scientific Programming) Tutorials Dr J. D. Enlow Last modified August 18, 2003. Contents Tutorial 1 : Introduction 3 Tutorial
More informationAttia, John Okyere. Control Statements. Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999
Attia, John Okyere. Control Statements. Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999 1999 by CRC PRESS LLC CHAPTER THREE CONTROL STATEMENTS 3.1 FOR
More informationPC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens.
PC-MATLAB PRIMER This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens. >> 2*3 ans = 6 PCMATLAB uses several lines for the answer, but I ve edited this to save space.
More informationProgramming in Mathematics. Mili I. Shah
Programming in Mathematics Mili I. Shah Starting Matlab Go to http://www.loyola.edu/moresoftware/ and login with your Loyola name and password... Matlab has eight main windows: Command Window Figure Window
More informationEE 216 Experiment 1. MATLAB Structure and Use
EE216:Exp1-1 EE 216 Experiment 1 MATLAB Structure and Use This first laboratory experiment is an introduction to the use of MATLAB. The basic computer-user interfaces, data entry techniques, operations,
More informationMATLAB Project: Getting Started with MATLAB
Name Purpose: To learn to create matrices and use various MATLAB commands for reference later MATLAB built-in functions used: [ ] : ; + - * ^, size, help, format, eye, zeros, ones, diag, rand, round, cos,
More information