The document discusses various plotting commands and functions in MATLAB. It begins with an outline of topics to be covered, which include the plot command, line specifications, additional plot commands, the fplot command for plotting functions, plotting 2D and 3D functions, and plotting complex numbers. Examples are provided to illustrate how to use the plot command to plot basic functions, combine multiple plots, and customize line properties. Additional commands like hold on and gca are described for combining plots and modifying axis properties. The document provides guidance on plotting, customizing plots, and saving figure files in MATLAB.
This tutorial provides an overview of using MATLAB for time-series analysis. It introduces the MATLAB programming environment and basic functions for array manipulation. It also covers visualizing time-series data in 2D and 3D plots and exploring applications such as similarity search, clustering, and classification of time-series data. The goal is to demonstrate how MATLAB enables efficient exploratory data analysis and visualization of time-series concepts through concise programming.
This document provides an introduction and overview of MATLAB. It covers MATLAB basics like matrices and arrays, plotting, and functions. The document is divided into sections on MATLAB desktop basics, matrices and arrays, graphics like line plots, programming and scripts, and help/documentation. It is intended as training material for a lab course on signal processing using MATLAB.
Advanced MATLAB Tutorial for Engineers & ScientistsRay Phan
This is a more advanced tutorial in the MATLAB programming environment for upper level undergraduate engineers and scientists at Ryerson University. The first half of the tutorial covers a quick review of MATLAB, which includes how to create vectors, matrices, how to plot graphs, and other useful syntax. The next part covers how to create cell arrays, logical operators, using the find command, creating Transfer Functions, finding the impulse and step response, finding roots of equations, and a few other useful tips. The last part covers more advanced concepts such as analytically calculating derivatives and integrals, polynomial regression, calculating the area under a curve, numerical solutions to differential equations, and sorting arrays.
This document provides an overview of MATLAB and the Signal Processing Toolbox. It discusses MATLAB basics like commands, functions, variables and matrices. It also introduces key signal processing concepts like representing signals, basic waveform generation, convolution, and filters. The Signal Processing Toolbox allows analyzing and processing signals and includes tools for digital filter design and implementation, spectral analysis, and filtering signals.
Matlab is a high-level programming language and environment used for numerical computation, visualization, and programming. The document outlines key Matlab concepts including the Matlab screen, variables, arrays, matrices, operators, plotting, flow control, m-files, and user-defined functions. Matlab allows users to analyze data, develop algorithms, and create models and applications.
The name MATLAB stands for MATrix LABoratory.MATLAB is a high-performance language for technical computing.
It integrates computation, visualization, and programming environment. Furthermore, MATLAB is a modern programming language environment: it has sophisticated data structures, contains built-in editing and debugging tools, and supports object-oriented programming.
These factor make MATLAB an excellent tool for teaching and research.
Matlab for beginners, Introduction, signal processingDr. Manjunatha. P
The document provides an introduction and overview of MATLAB. It discusses that MATLAB was initially developed as a tool to help students learn linear algebra and is now a widely used software package for engineering and mathematical problems. The document then covers various MATLAB windows and basics like variables, matrices, plot commands, m-files, and flow control structures like for loops and if/else statements. It also provides examples of plotting functions and creating graphs with labels and titles.
A basic overview, application and usage of MATLAB for engineers. It covered very basics essential that will help one to get started with MATLAB programming easily.
Provided by IDEAS2IGNITE
This tutorial provides an overview of using MATLAB for time-series analysis. It introduces the MATLAB programming environment and basic functions for array manipulation. It also covers visualizing time-series data in 2D and 3D plots and exploring applications such as similarity search, clustering, and classification of time-series data. The goal is to demonstrate how MATLAB enables efficient exploratory data analysis and visualization of time-series concepts through concise programming.
This document provides an introduction and overview of MATLAB. It covers MATLAB basics like matrices and arrays, plotting, and functions. The document is divided into sections on MATLAB desktop basics, matrices and arrays, graphics like line plots, programming and scripts, and help/documentation. It is intended as training material for a lab course on signal processing using MATLAB.
Advanced MATLAB Tutorial for Engineers & ScientistsRay Phan
This is a more advanced tutorial in the MATLAB programming environment for upper level undergraduate engineers and scientists at Ryerson University. The first half of the tutorial covers a quick review of MATLAB, which includes how to create vectors, matrices, how to plot graphs, and other useful syntax. The next part covers how to create cell arrays, logical operators, using the find command, creating Transfer Functions, finding the impulse and step response, finding roots of equations, and a few other useful tips. The last part covers more advanced concepts such as analytically calculating derivatives and integrals, polynomial regression, calculating the area under a curve, numerical solutions to differential equations, and sorting arrays.
This document provides an overview of MATLAB and the Signal Processing Toolbox. It discusses MATLAB basics like commands, functions, variables and matrices. It also introduces key signal processing concepts like representing signals, basic waveform generation, convolution, and filters. The Signal Processing Toolbox allows analyzing and processing signals and includes tools for digital filter design and implementation, spectral analysis, and filtering signals.
Matlab is a high-level programming language and environment used for numerical computation, visualization, and programming. The document outlines key Matlab concepts including the Matlab screen, variables, arrays, matrices, operators, plotting, flow control, m-files, and user-defined functions. Matlab allows users to analyze data, develop algorithms, and create models and applications.
The name MATLAB stands for MATrix LABoratory.MATLAB is a high-performance language for technical computing.
It integrates computation, visualization, and programming environment. Furthermore, MATLAB is a modern programming language environment: it has sophisticated data structures, contains built-in editing and debugging tools, and supports object-oriented programming.
These factor make MATLAB an excellent tool for teaching and research.
Matlab for beginners, Introduction, signal processingDr. Manjunatha. P
The document provides an introduction and overview of MATLAB. It discusses that MATLAB was initially developed as a tool to help students learn linear algebra and is now a widely used software package for engineering and mathematical problems. The document then covers various MATLAB windows and basics like variables, matrices, plot commands, m-files, and flow control structures like for loops and if/else statements. It also provides examples of plotting functions and creating graphs with labels and titles.
A basic overview, application and usage of MATLAB for engineers. It covered very basics essential that will help one to get started with MATLAB programming easily.
Provided by IDEAS2IGNITE
MATLAB is a programming language for technical computing and data analysis. It allows users to perform arithmetic operations, use mathematical functions, manipulate data, create plots and graphs, write programs using conditional statements and loops. The document provides an overview of MATLAB's interface and important terms, and demonstrates how to perform common tasks like creating arrays and matrices, plotting data, writing for and while loops, and defining functions. MATLAB is relevant for tasks in many engineering fields like signal processing, optimization, finite element analysis, and statistical analysis.
This document provides an introduction to the basics of MATLAB. It discusses where to find help in MATLAB, how to work with matrices and perform basic operations on them. It also covers logical conditions, different types of loops (for, while, if/else), how to create scripts and functions. Finally, it provides an overview of visualization and graphics in MATLAB as well as an introduction to the image processing toolbox.
MATLAB is a numerical computing environment and programming language. It allows matrix manipulations, plotting of functions and data, implementation of algorithms, and interfacing with programs in other languages. MATLAB can be used for applications like signal processing, image processing, control systems, and computational finance. It offers advantages like ease of use, platform independence, and predefined functions. However, it can sometimes be slow and is commercial software. The MATLAB interface includes a command window, current directory, workspace, and command history. Arrays are fundamental data types in MATLAB and can be vectors, matrices, or multidimensional. Variables are used to store information in the workspace and can represent different data types. Common operations include arithmetic, functions, and following the
This document provides an overview of MATLAB. It discusses the history and invention of MATLAB, with a focus on how it was created by Cleve Moler at the University of New Mexico to make numerical computing libraries easier to use. The document outlines MATLAB's structure, features, programming capabilities and applications. Key advantages are its accuracy for matrix operations and ability to visualize results. Weaknesses include slower speed as an interpreted language and limited use for general purpose programming.
This document provides an introduction to MATLAB. It discusses what MATLAB is, the MATLAB screen interface, variables and arrays, basic arithmetic and relational operators, functions, plotting, and matrices. Key aspects covered include creating and using variables, performing calculations, controlling precision of outputs, getting help, and using basic mathematical functions in MATLAB. The document is intended to familiarize users with essential MATLAB features for use in courses.
The document provides an introduction to MATLAB, describing the main environment components like the command window and workspace. It explains basic MATLAB functions and variables, arrays, control flow statements, M-files, and common plotting and data analysis tools. Examples are given of different array operations, control structures, and building simple MATLAB functions and scripts.
This document provides an introduction and overview of MATLAB. It discusses the MATLAB environment, how to get help, variables, vectors, matrices, linear algebra, mathematical functions, plotting, selection programming, M-files, and user defined functions in MATLAB. The key topics covered include how to start MATLAB, the different display windows, assigning and working with variables, creating and manipulating vectors and matrices, and solving systems of linear equations using MATLAB.
This presentation provides an introduction to MATLAB. It discusses what MATLAB is, its advantages and disadvantages, typical uses, and how to start the MATLAB environment. It demonstrates basic MATLAB commands like plotting a sine wave and performing calculations. It also covers different types of files used in MATLAB like M-files, MAT-files and MEX-files. The presentation shows how to address matrices, perform matrix operations, and use functions to build matrices. It encourages viewers to access the online MATLAB helpdesk for additional information and support.
This document provides an overview of MATLAB, including:
- MATLAB is a program for numerical computation originally designed for linear algebra problems using matrices. It has since expanded to other types of scientific computations and graphics.
- The main components of the MATLAB interface are the command window, workspace, history, and editor. Help is accessed using commands like help, doc, and demo.
- MATLAB treats all variables as matrices and supports vectors, scalars, and relational, logical, and math operators on matrices. Functions include trigonometric, exponential, logical, and matrix functions.
- Plots can be generated by passing vectors to plot, and annotated using commands like title, xlabel, ylabel, and legend. Flow control includes if/
This document provides an overview of MATLAB, including:
- MATLAB is a programming language and environment used for scientific and engineering calculations. It is matrix-oriented and supports graphical programming.
- MATLAB can be used for 3D plotting, vector and matrix operations, and modeling dynamic systems using Simulink. It includes tools for variables, functions, loops, and plotting graphs.
- MATLAB has applications in fields like aerospace, biomedicine, signal processing, and more. Companies like NASA, GE, and Bosch utilize MATLAB.
This document discusses using MATLAB to generate a sine wave with minimal computational complexity. It shows that a sine wave can be generated with just three lines of code by plotting x values from 0.1 to 10 against sine of x. This demonstrates MATLAB's simplicity and power as an engineering tool.
This document provides an introduction and overview of MATLAB (Matrix Laboratory), an interactive program for numerical computation and visualization. It discusses basic MATLAB commands and functions for creating variables and matrices, performing mathematical operations, plotting graphs, and working with polynomials.
MATLAB is a matrix laboratory software package for numerical computation and visualization. It provides functions and tools for matrix manipulation, plotting and visualization, implementation of algorithms, data analysis, and numerical solution of problems. MATLAB has a programming language and interactive environment for algorithm development, data visualization, data analysis and numeric computation. It supports matrix and array operations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages.
This document provides an introduction to MATLAB, covering topics such as its command-oriented interface, variable names, matrices, plotting, logical and relational operators, and toolboxes. MATLAB was originally designed for solving linear algebra problems using matrices and treats all variables as matrices. It allows importing/exporting data and contains toolboxes for tasks like signal processing, control systems, statistics and more.
This document provides an overview of MATLAB for geoscientists. It describes MATLAB as a high-level language and interactive environment for numerical computation, visualization, and programming. Key features of MATLAB include its high-level language for numerical analysis, interactive environment, built-in mathematical functions, graphics for data visualization, and tools for algorithm and application development. The document discusses matrices, variables, basic arithmetic and programming in MATLAB, and provides examples of using MATLAB for tasks like plotting functions, solving equations, and working with arrays.
You'll get everything you need to get started with programming in MATLAB. What you will learn:
-Matrices and Vectors
-2-D Plotting
-User-defined functions
-Logical statements: if-elseif, switch-case
-Looping techniques: for and while loops
-Plus more!
This document provides an introduction to MATLAB. It discusses what MATLAB is, how to perform basic matrix operations and use script files and M-files. It also covers some common MATLAB commands and functions. MATLAB can be used for applications like plotting, image processing, robotics and GUI design. Key topics covered include matrices, vectors, scalars, matrix operations, logical and relational operators, selection and repetition structures, and reading/writing data files. Plotting functions allow creating graphs and 3D surface plots. Image processing, robotics and GUI design are listed as potential application areas.
MATLAB is an integrated technical computing environment for numeric computation, advanced graphics and visualization, and programming. It allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation and execution of scripts and functions. The MATLAB desktop provides the command window, editor, workspace and other tools. Key features include support for multidimensional arrays, mathematical functions, plotting, scripting and conditional/loop control statements.
MATLAB is a powerful programming language for technical computing. It allows matrix manipulation, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs in other languages. Some key features of MATLAB include its matrix-based data structure, built-in math and engineering functions, programming tools for algorithm development and testing, and integrated development environment. MATLAB also provides tools for debugging and optimizing code performance such as breakpoints, stepping through code, and the profiler.
Here are the steps to plot the given functions using MATLAB:
1. Plot y = 0.4x + 1.8 for 0 ≤ x ≤ 35 and 0 ≤ y ≤ 3.5:
x = 0:35;
y = 0.4.*x + 1.8;
plot(x,y)
xlim([0 35])
ylim([0 3.5])
2. Plot imaginary vs real parts of 0.2 + 0.8i*n for 0 ≤ n ≤ 20:
n = 0:20;
z = 0.2 + 0.8i*n;
plot(real(z),imag(z))
xlabel('Real Part')
MATLAB DOCUMENTATION ON SOME OF THE MODULES
A.Generate videos in which a skeleton of a person doing the following Gestures.
1.Tilting his head to right and left
2.Tilting his hand to right and left
3.Walking
in matlab.
B. Write a MATLAB program that converts a decimal number to Roman number and vice versa.
C.Using EZ plot & anonymous functions plot the following:
· Y=Sqrt(X)
· Y= X^2
· Y=e^(-XY)
D.Take your picture and
· Show R, G, B channels along with RGB Image in same figure using sub figure.
· Convert into HSV( Hue, saturation and value) and show the H,S,V channels along with HSV image
E.Record your name pronounced by yourself. Try to display the signal(name) in a plot vs Time, using matlab.
F.Write a script to open a new figure and plot five circles, all centered at the origin and with increasing radii. Set the line width for each circle to something thick (at least 2 points), and use the colors from a 5-color jet colormap (jet).
G. NEWTON RAPHSON AND SECANT METHOD
H.Write any one of the program to do following things using file concept.
1.Create or Open a file
2. Read data from the file and write data to another file
3. Append some text to already existed file
4. Close the file
I.Write a function to perform following set operations
1.Union of A and B
2. Intersection of A and B
3. Complement of A and B
(Assume A= {1, 2, 3, 4, 5, 6}, B= {2, 4, 6})
MATLAB is a programming language for technical computing and data analysis. It allows users to perform arithmetic operations, use mathematical functions, manipulate data, create plots and graphs, write programs using conditional statements and loops. The document provides an overview of MATLAB's interface and important terms, and demonstrates how to perform common tasks like creating arrays and matrices, plotting data, writing for and while loops, and defining functions. MATLAB is relevant for tasks in many engineering fields like signal processing, optimization, finite element analysis, and statistical analysis.
This document provides an introduction to the basics of MATLAB. It discusses where to find help in MATLAB, how to work with matrices and perform basic operations on them. It also covers logical conditions, different types of loops (for, while, if/else), how to create scripts and functions. Finally, it provides an overview of visualization and graphics in MATLAB as well as an introduction to the image processing toolbox.
MATLAB is a numerical computing environment and programming language. It allows matrix manipulations, plotting of functions and data, implementation of algorithms, and interfacing with programs in other languages. MATLAB can be used for applications like signal processing, image processing, control systems, and computational finance. It offers advantages like ease of use, platform independence, and predefined functions. However, it can sometimes be slow and is commercial software. The MATLAB interface includes a command window, current directory, workspace, and command history. Arrays are fundamental data types in MATLAB and can be vectors, matrices, or multidimensional. Variables are used to store information in the workspace and can represent different data types. Common operations include arithmetic, functions, and following the
This document provides an overview of MATLAB. It discusses the history and invention of MATLAB, with a focus on how it was created by Cleve Moler at the University of New Mexico to make numerical computing libraries easier to use. The document outlines MATLAB's structure, features, programming capabilities and applications. Key advantages are its accuracy for matrix operations and ability to visualize results. Weaknesses include slower speed as an interpreted language and limited use for general purpose programming.
This document provides an introduction to MATLAB. It discusses what MATLAB is, the MATLAB screen interface, variables and arrays, basic arithmetic and relational operators, functions, plotting, and matrices. Key aspects covered include creating and using variables, performing calculations, controlling precision of outputs, getting help, and using basic mathematical functions in MATLAB. The document is intended to familiarize users with essential MATLAB features for use in courses.
The document provides an introduction to MATLAB, describing the main environment components like the command window and workspace. It explains basic MATLAB functions and variables, arrays, control flow statements, M-files, and common plotting and data analysis tools. Examples are given of different array operations, control structures, and building simple MATLAB functions and scripts.
This document provides an introduction and overview of MATLAB. It discusses the MATLAB environment, how to get help, variables, vectors, matrices, linear algebra, mathematical functions, plotting, selection programming, M-files, and user defined functions in MATLAB. The key topics covered include how to start MATLAB, the different display windows, assigning and working with variables, creating and manipulating vectors and matrices, and solving systems of linear equations using MATLAB.
This presentation provides an introduction to MATLAB. It discusses what MATLAB is, its advantages and disadvantages, typical uses, and how to start the MATLAB environment. It demonstrates basic MATLAB commands like plotting a sine wave and performing calculations. It also covers different types of files used in MATLAB like M-files, MAT-files and MEX-files. The presentation shows how to address matrices, perform matrix operations, and use functions to build matrices. It encourages viewers to access the online MATLAB helpdesk for additional information and support.
This document provides an overview of MATLAB, including:
- MATLAB is a program for numerical computation originally designed for linear algebra problems using matrices. It has since expanded to other types of scientific computations and graphics.
- The main components of the MATLAB interface are the command window, workspace, history, and editor. Help is accessed using commands like help, doc, and demo.
- MATLAB treats all variables as matrices and supports vectors, scalars, and relational, logical, and math operators on matrices. Functions include trigonometric, exponential, logical, and matrix functions.
- Plots can be generated by passing vectors to plot, and annotated using commands like title, xlabel, ylabel, and legend. Flow control includes if/
This document provides an overview of MATLAB, including:
- MATLAB is a programming language and environment used for scientific and engineering calculations. It is matrix-oriented and supports graphical programming.
- MATLAB can be used for 3D plotting, vector and matrix operations, and modeling dynamic systems using Simulink. It includes tools for variables, functions, loops, and plotting graphs.
- MATLAB has applications in fields like aerospace, biomedicine, signal processing, and more. Companies like NASA, GE, and Bosch utilize MATLAB.
This document discusses using MATLAB to generate a sine wave with minimal computational complexity. It shows that a sine wave can be generated with just three lines of code by plotting x values from 0.1 to 10 against sine of x. This demonstrates MATLAB's simplicity and power as an engineering tool.
This document provides an introduction and overview of MATLAB (Matrix Laboratory), an interactive program for numerical computation and visualization. It discusses basic MATLAB commands and functions for creating variables and matrices, performing mathematical operations, plotting graphs, and working with polynomials.
MATLAB is a matrix laboratory software package for numerical computation and visualization. It provides functions and tools for matrix manipulation, plotting and visualization, implementation of algorithms, data analysis, and numerical solution of problems. MATLAB has a programming language and interactive environment for algorithm development, data visualization, data analysis and numeric computation. It supports matrix and array operations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages.
This document provides an introduction to MATLAB, covering topics such as its command-oriented interface, variable names, matrices, plotting, logical and relational operators, and toolboxes. MATLAB was originally designed for solving linear algebra problems using matrices and treats all variables as matrices. It allows importing/exporting data and contains toolboxes for tasks like signal processing, control systems, statistics and more.
This document provides an overview of MATLAB for geoscientists. It describes MATLAB as a high-level language and interactive environment for numerical computation, visualization, and programming. Key features of MATLAB include its high-level language for numerical analysis, interactive environment, built-in mathematical functions, graphics for data visualization, and tools for algorithm and application development. The document discusses matrices, variables, basic arithmetic and programming in MATLAB, and provides examples of using MATLAB for tasks like plotting functions, solving equations, and working with arrays.
You'll get everything you need to get started with programming in MATLAB. What you will learn:
-Matrices and Vectors
-2-D Plotting
-User-defined functions
-Logical statements: if-elseif, switch-case
-Looping techniques: for and while loops
-Plus more!
This document provides an introduction to MATLAB. It discusses what MATLAB is, how to perform basic matrix operations and use script files and M-files. It also covers some common MATLAB commands and functions. MATLAB can be used for applications like plotting, image processing, robotics and GUI design. Key topics covered include matrices, vectors, scalars, matrix operations, logical and relational operators, selection and repetition structures, and reading/writing data files. Plotting functions allow creating graphs and 3D surface plots. Image processing, robotics and GUI design are listed as potential application areas.
MATLAB is an integrated technical computing environment for numeric computation, advanced graphics and visualization, and programming. It allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation and execution of scripts and functions. The MATLAB desktop provides the command window, editor, workspace and other tools. Key features include support for multidimensional arrays, mathematical functions, plotting, scripting and conditional/loop control statements.
MATLAB is a powerful programming language for technical computing. It allows matrix manipulation, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs in other languages. Some key features of MATLAB include its matrix-based data structure, built-in math and engineering functions, programming tools for algorithm development and testing, and integrated development environment. MATLAB also provides tools for debugging and optimizing code performance such as breakpoints, stepping through code, and the profiler.
Here are the steps to plot the given functions using MATLAB:
1. Plot y = 0.4x + 1.8 for 0 ≤ x ≤ 35 and 0 ≤ y ≤ 3.5:
x = 0:35;
y = 0.4.*x + 1.8;
plot(x,y)
xlim([0 35])
ylim([0 3.5])
2. Plot imaginary vs real parts of 0.2 + 0.8i*n for 0 ≤ n ≤ 20:
n = 0:20;
z = 0.2 + 0.8i*n;
plot(real(z),imag(z))
xlabel('Real Part')
MATLAB DOCUMENTATION ON SOME OF THE MODULES
A.Generate videos in which a skeleton of a person doing the following Gestures.
1.Tilting his head to right and left
2.Tilting his hand to right and left
3.Walking
in matlab.
B. Write a MATLAB program that converts a decimal number to Roman number and vice versa.
C.Using EZ plot & anonymous functions plot the following:
· Y=Sqrt(X)
· Y= X^2
· Y=e^(-XY)
D.Take your picture and
· Show R, G, B channels along with RGB Image in same figure using sub figure.
· Convert into HSV( Hue, saturation and value) and show the H,S,V channels along with HSV image
E.Record your name pronounced by yourself. Try to display the signal(name) in a plot vs Time, using matlab.
F.Write a script to open a new figure and plot five circles, all centered at the origin and with increasing radii. Set the line width for each circle to something thick (at least 2 points), and use the colors from a 5-color jet colormap (jet).
G. NEWTON RAPHSON AND SECANT METHOD
H.Write any one of the program to do following things using file concept.
1.Create or Open a file
2. Read data from the file and write data to another file
3. Append some text to already existed file
4. Close the file
I.Write a function to perform following set operations
1.Union of A and B
2. Intersection of A and B
3. Complement of A and B
(Assume A= {1, 2, 3, 4, 5, 6}, B= {2, 4, 6})
Introduction
Plotting basic 2-D plots.
The plot command
The fplot command
Plotting multiple graphs in the same plot
Formatting plots
USING THE plot() COMMAND TO PLOT
MULTIPLE GRAPHS IN THE SAME PLOT
MATLAB PROGRAM TO PLOT VI CHARACTERISTICS OF A DIODE
SUMMARY
This document contains lecture materials for digital communication lab experiments in MATLAB. It includes four experiments on topics like signals in MATLAB, digital modulation, and transfer functions. The first experiment discusses variables, arrays, vectors and matrices. It provides examples of creating and manipulating these data structures. The second experiment demonstrates different MATLAB functions for plotting signals like stem, plot and stairs. The third experiment covers digital convolution using the conv and subplot functions. The fourth experiment describes how to model a system transfer function and find its response to different inputs using MATLAB commands like tf, step and impulse.
This document discusses various MATLAB plotting commands and techniques. It begins by explaining how to create basic 2D plots using the plot() command to plot x-y data or a function. It also covers formatting plots by adding titles, labels, legends etc. The document then discusses plotting multiple graphs in the same figure using either the plot() command or hold on/off commands. Finally, it demonstrates how to create multiple subplots on one figure using the subplot command.
This document provides an introduction to MATLAB. It discusses that MATLAB is a high-performance language for technical computing that integrates computation, visualization, and programming. It can be used for tasks like math and computation, algorithm development, modeling, simulation, prototyping, data analysis, and scientific graphics. MATLAB uses arrays as its basic data type and allows matrix and vector problems to be solved more quickly than with other languages. The document then provides examples of entering matrices, using basic MATLAB commands and functions, plotting graphs, and writing MATLAB code in M-files.
This document introduces new commands in Matlab lesson 3 for creating plots, including plot(x,y) to create Cartesian plots, semilogx(x,y) to plot log(x) vs y, and bar(x) to create bar graphs. It also discusses using titles, labels, text and grids with plots, and describes polar, multiple, and fancy plots using different line styles and point markers. The document concludes with instructions for printing and saving graphic plots.
This document discusses implementing graph convolutional networks in Apache Spark for intelligent workflow automation. It provides background on deep learning models and graph neural networks. It then describes experiment steps for implementing a graph convolutional network on the Cora dataset using Spark, Breeze, and Analytics Zoo. The model achieves an accuracy of 0.769202 on the Cora dataset when using a spectral graph convolution approach with renormalization. Visualizations show the learned representations improve with the use of convolutions on the graph.
Here are the steps to solve this problem numerically in MATLAB:
1. Define the 2nd order ODE for the pendulum as two first order equations:
y1' = y2
y2' = -sin(y1)
2. Create an M-file function pendulum.m that returns the right hand side:
function dy = pendulum(t,y)
dy = [y(2); -sin(y(1))];
end
3. Use an ODE solver like ode45 to integrate from t=0 to t=6pi with initial conditions y1(0)=pi, y2(0)=0:
[t,y] = ode45
This document provides an introduction to MATLAB. It covers MATLAB basics like arithmetic, variables, vectors, matrices and built-in functions. It also discusses plotting graphs, programming in MATLAB by creating functions and scripts, and solving systems of linear equations. The document is compiled by Endalkachew Teshome from the Department of Mathematics at AMU for teaching MATLAB.
This document provides an outline for a course on Optimization and Economics of Integrated Power Systems. The course will cover topics such as optimization basics, power systems basics, MATLAB review, and examples of optimization techniques applied to power systems, including linear, nonlinear, integer, and mixed integer programming. It also provides details on using MATLAB, including basics of variables, matrices, plotting, and loops. Equations and concepts from calculus relevant to optimization are defined, such as gradients, Hessians, and Taylor series.
The document describes using MATLAB to plot various two-dimensional and three-dimensional plots, generate different types of signals used in signal processing, compare discrete and continuous ramp signals, compute the linear convolution of two sequences, illustrate folding and time shifting of sequences. MATLAB commands like plot, plot3, stem, conv are used to generate graphs and signals. Various experiments are presented on plotting functions, signals, and operations like convolution in MATLAB.
MATLAB can be used for calculation, plotting, image processing, and modeling. It allows defining variables and performing operations on vectors, arrays, and matrices. Key functions include plotting graphs, solving equations, performing calculus operations like derivatives and integrals, and applying built-in functions to arrays.
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Raffi Khatchadourian
The document discusses challenges in migrating imperative deep learning programs to graph execution. It provides examples of TensorFlow imperative code that uses features like Python side effects and variables that do not directly translate to graph execution. Specifically, it shows how a model that uses a counter variable to increment another variable on each call would not work as expected, as the initial counter value is captured during tracing, resulting in the variable being incremented on each call rather than just the first one. This demonstrates common problems that can arise from migrating imperative code to graphs and result in unexpected numerical results or reduced performance.
The document discusses transformations of linear functions. It provides examples of translating graphs vertically and horizontally by adding or subtracting values from inputs and outputs. It also discusses reflecting graphs over the x-axis or y-axis by multiplying inputs or outputs by -1. Horizontal and vertical stretches and shrinks are described as multiplying the inputs or outputs by a scale factor. The key is that transformations preserve the shape of the graph but can change its position, orientation, or scale.
MATLAB is a programming tool that simplifies programming compared to languages like C and C#. The document introduces basic MATLAB functions like help, inputting matrices and vectors, matrix operations, loops, conditional statements, and graphs. It also covers symbolic math, Laplace transforms, Fourier transforms, and other domains and transforms. The overall document serves as an introduction to essential MATLAB programming concepts and capabilities.
Para un mismo problema existe más de una solución aunque a veces existen barreras tecnicas que nos impiden abordarlas. Esta presentación pretende mostrar como, gracias a Kotlin, se nos abren otras opciones a la hora de abordar los problemas, centrandonos en nuestros problemas particulares y delegando a un segundo plano problemas recurrentes como la gestión de errores o la concurrencia.
The document discusses the benefits of declarative programming using Scala. It provides examples of implementing algorithms and data structures declaratively in Scala. It also discusses the history and future of Scala, as well as how Scala encourages thinking about programs as transformations rather than changes to memory.
MATLAB is an interactive development environment and programming language used by engineers and scientists for technical computing, data analysis, and algorithm development. It allows users to access data from files, web services, applications, hardware, and databases, and perform data analysis and visualization. MATLAB can be used for applications in areas like control systems, signal processing, communications, and more.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
How to Add Chatter in the odoo 17 ERP ModuleCeline George
In Odoo, the chatter is like a chat tool that helps you work together on records. You can leave notes and track things, making it easier to talk with your team and partners. Inside chatter, all communication history, activity, and changes will be displayed.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Thinking of getting a dog? Be aware that breeds like Pit Bulls, Rottweilers, and German Shepherds can be loyal and dangerous. Proper training and socialization are crucial to preventing aggressive behaviors. Ensure safety by understanding their needs and always supervising interactions. Stay safe, and enjoy your furry friends!
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
How to Fix the Import Error in the Odoo 17Celine George
An import error occurs when a program fails to import a module or library, disrupting its execution. In languages like Python, this issue arises when the specified module cannot be found or accessed, hindering the program's functionality. Resolving import errors is crucial for maintaining smooth software operation and uninterrupted development processes.
3. Plotting in MATLAB
Outline
1 “Plot” Command
2 LineSpec(Line Specification)
2 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
4. Plotting in MATLAB
Outline
1 “Plot” Command
2 LineSpec(Line Specification)
3 Some Important Additional Commands in Plot
2 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
5. Plotting in MATLAB
Outline
1 “Plot” Command
2 LineSpec(Line Specification)
3 Some Important Additional Commands in Plot
4 “fplot” Command
2 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
6. Plotting in MATLAB
Outline
1 “Plot” Command
2 LineSpec(Line Specification)
3 Some Important Additional Commands in Plot
4 “fplot” Command
5 Two variable function( or 3D) plot
2 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
7. Plotting in MATLAB
Outline
1 “Plot” Command
2 LineSpec(Line Specification)
3 Some Important Additional Commands in Plot
4 “fplot” Command
5 Two variable function( or 3D) plot
6 Plotting complex numbers
2 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
8. Plotting in MATLAB
Plot
Basic Command for Plotting
Two-dimensional line and symbol plots are created with the
plot command. In its simplest form plot takes two arguments:
plot(xdata, ydata)
where xdata and ydata are vectors containing the data.
3 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
9. Plotting in MATLAB
Plot
Basic Command for Plotting
Two-dimensional line and symbol plots are created with the
plot command. In its simplest form plot takes two arguments:
plot(xdata, ydata)
where xdata and ydata are vectors containing the data.
Note that xdata and ydata must be the same length and
both must be the same type, i.e., both must be either
row or column vectors.
3 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
10. Plotting in MATLAB
Plot
Plot Commands
plot
2-D line plot
syntax
plot(X,Y)
plot(X,Y,LineSpec)
plot(X1,Y1,...,Xn,Yn)
plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn)
plot(Y)
plot(Y,LineSpec)
4 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
11. Plotting in MATLAB
Plot
plot(X,Y) creates a 2-D line plot of the data in Y versus the
corresponding values in X.
plot(X,Y,LineSpec) sets the line style, marker symbol, and color.
plot(X1,Y1,...,Xn,Yn) plots multiple X, Y pairs using the same axes
for all lines.
plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn) sets the line style,
marker type, and color for each line
plot(Y) creates a 2-D line plot of the data in Y versus the index of
each value.
If Y is a vector, then the x-axis scale ranges from 1 to
length(Y).
If Y is a matrix, then the plot function plots the columns of Y
versus their row number. The x-axis scale ranges from 1 to
the number of rows in Y.
If Y is complex, then the plot function plots the imaginary
part of Y versus the real part of Y, such that plot(Y) is
equivalent to plot(real(Y),imag(Y)).
plot(Y,LineSpec) sets the line style, marker symbol, and color. 5 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
12. Plotting in MATLAB
Plot
Example 1
Plot the function y = sin(x) over the interval [−2π, 2π]
6 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
13. Plotting in MATLAB
Plot
Example 1
Plot the function y = sin(x) over the interval [−2π, 2π]
x=-2*pi:pi/100:2*pi;
or
x=linspace(-2*pi,2*pi)
y=sin(x);
plot(x,y)
6 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
15. Plotting in MATLAB
Plot
Example 2
Plot the functions y1 = sin(x) and y2 = cos(x) over the
interval [−2π, 2π]
8 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
16. Plotting in MATLAB
Plot
Example 2
Plot the functions y1 = sin(x) and y2 = cos(x) over the
interval [−2π, 2π]
x=linspace(-2*pi,2*pi);
y1=sin(x);
y2=cos(x);
plot(x,y1,x,y2)
8 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
18. Plotting in MATLAB
Plot
Point to Remember
If you are plotting a graph by using any of the operations:
Power (or Exponent)
Multiplications
Division
Then always put a “.”(dot) before these operations.
i.e., type x.^2, x.*y, x./y and 1./x instead of typing
x^2, x*y, x/y and 1/x respectively.
10 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
19. Plotting in MATLAB
Plot
Parametric Plot
Example 3
Plot the parametric curves x = tcos(t) and y = tsin(t)
over[0, 2π].
11 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
20. Plotting in MATLAB
Plot
Parametric Plot
Example 3
Plot the parametric curves x = tcos(t) and y = tsin(t)
over[0, 2π].
t=linspace(0,2*pi);
x=t.*sin(t);
y=t.*cos(t);
plot(x,y)
11 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
22. Plotting in MATLAB
Plot
Saving Plots into High Quality Images
You can save plot of any function into high quality image in
figure window as follows:
File → ExportSetup → Properties → Rendering → Resolution
Choose the highest resolution and click on Export. Finally
save the file in JPG format.
13 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
25. Plotting in MATLAB
LineSpec(Line Specification)
LineSpec (Line Specification)
The color, point marker, and line style can be changed on a
plot by adding a third parameter (in single quotes) to the plot
command.
Syntax:
plot(x, y, LineSpec )
16 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
26. Plotting in MATLAB
LineSpec(Line Specification)
LineSpec Table
Color Point Marker Line Style
y yellow . point – solid
m magenta o circle : dotted
c cyan x x-mark –. dashdot
r red + plus – – dashed
g green * star
b blue s square
w white d diamond
k black ∨ triangle(down)
∧ triangle(up)
< triangle(left)
> triangle(right)
p pentagram
h hexagon
17 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
27. Plotting in MATLAB
LineSpec(Line Specification)
Example 4
Plot the function y = x3
− 1 with blue dashed lines.
18 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
28. Plotting in MATLAB
LineSpec(Line Specification)
Example 4
Plot the function y = x3
− 1 with blue dashed lines.
x = linspace(-10,10);
y=x.^3-1;
plot(x,y,’b--’)
18 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
30. Plotting in MATLAB
Some Important Additional Commands in Plot
Combining Two Plots
We can combine two plots by the command
hold on;
20 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
31. Plotting in MATLAB
Some Important Additional Commands in Plot
Combining Two Plots
We can combine two plots by the command
hold on;
If we apply this to Example 2, then we need to write
x=linspace(-2*pi,2*pi);
y1=sin(x);
y2=cos(x);
plot(x,y1)
hold on;
plot(x,y2)
20 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
32. Plotting in MATLAB
Some Important Additional Commands in Plot
Displaying the x-axis and y-axis intersecting at
Origin
Note that, by default, the x-axis is at the bottom of the graph
and the y-axis is on the left side. So, if you want to display the
x-axis and y-axis lines so that they cross at the origin point
(0, 0), we add the following command;
21 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
33. Plotting in MATLAB
Some Important Additional Commands in Plot
Displaying the x-axis and y-axis intersecting at
Origin
Note that, by default, the x-axis is at the bottom of the graph
and the y-axis is on the left side. So, if you want to display the
x-axis and y-axis lines so that they cross at the origin point
(0, 0), we add the following command;
ax=gca;
ax.XAxisLocation=’origin’;
ax.YAxisLocation=’origin’;
Note:
ax=gca; returns the current axes for the current figure
that can be used to access and modify properties of the
axes.
21 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
34. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 5
Plot the function y = xSin(x) over the interval [-10,10] and
also show the x-axis and y-axis intersecting at origin.
22 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
35. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 5
Plot the function y = xSin(x) over the interval [-10,10] and
also show the x-axis and y-axis intersecting at origin.
x=linspace(-10,10);
y=x.*sin(x);
plot(x,y)
ax=gca;
ax.XAxisLocation=’origin’;
ax.YAxisLocation=’origin’;
22 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
36. Plotting in MATLAB
Some Important Additional Commands in Plot
23 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
37. Plotting in MATLAB
Some Important Additional Commands in Plot
Removing Outline
If you don’t want to show the axes outline, then you can use
the command.
ax.Box=’off’;
24 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
38. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 6
Plot the function y = xSin(x) over the interval [-10,10]
without axis outline.
25 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
39. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 6
Plot the function y = xSin(x) over the interval [-10,10]
without axis outline.
x=linspace(-10,10);
y=x.*sin(x);
plot(x,y)
ax=gca;
ax.XAxisLocation=’origin’;
ax.YAxisLocation=’origin’;
ax.Box=’off’;
25 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
40. Plotting in MATLAB
Some Important Additional Commands in Plot
26 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
41. Plotting in MATLAB
Some Important Additional Commands in Plot
Changing the Location of the Tick Marks
We use the following commands for changing the location of
the tick marks on x-axis and y-axis.
ax.XTick=[a1, a2, . . . , am];
ax.YTick=[b1, b2, . . . , bn];
Note: We can replace comma by space in each command.
27 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
42. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 7
Plot the function y = x2
over the interval [0,10] and display
tick marks along the x-axis at the values 0, 5, and 10.
28 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
43. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 7
Plot the function y = x2
over the interval [0,10] and display
tick marks along the x-axis at the values 0, 5, and 10.
x = linspace(0,10);
y = x.^2;
plot(x,y)
ax=gca;
ax.XTick=[0,5,10];
28 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
44. Plotting in MATLAB
Some Important Additional Commands in Plot
29 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
45. Plotting in MATLAB
Some Important Additional Commands in Plot
we can also change the location of tick marks on y-axis as
x = linspace(0,10);
y = x.^2;
plot(x,y)
ax=gca;
ax.XTick=[0,5,10];
ax.YTick=[0,20,40,60,80,100];
30 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
46. Plotting in MATLAB
Some Important Additional Commands in Plot
31 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
47. Plotting in MATLAB
Some Important Additional Commands in Plot
Labeling the Tick Marks
We can label the tick marks on x-axis and y-axis by the
commands
ax.XTickLabel={’Label1’ , ’Label2’, . . . , ’Labelm’};
ax.YTickLabel={’Label1’ , ’Label2’, . . . , ’Labeln’};
32 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
48. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 8
Plot the function y = x2
over the interval [0,10] and display
tick marks along the x-axis at the values 0, 5, and 10.Then
specify a label for each tick mark.
33 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
49. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 8
Plot the function y = x2
over the interval [0,10] and display
tick marks along the x-axis at the values 0, 5, and 10.Then
specify a label for each tick mark.
x = linspace(0,10);
y = x.^2;
plot(x,y)
ax=gca;
ax.XTick=[0,5,10];
ax.XTickLabel={’x=0’,’x=5’,’x=10’};
33 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
50. Plotting in MATLAB
Some Important Additional Commands in Plot
34 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
51. Plotting in MATLAB
Some Important Additional Commands in Plot
Upgraded Commands
MATLAB’s latest version (either 2017a or 2017b) has some
new commands and four of them are as follows:
xticks([a1, a2, . . . , am]);
yticks([b1, b2, . . . , bn]);
xticklabels({’Label1’ , ’Label2’, . . . , ’Labelm’});
yticklabels({’Label1’ , ’Label2’, . . . , ’Labeln’});
These commands are upgraded form of previous four
commands.
35 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
52. Plotting in MATLAB
Some Important Additional Commands in Plot
New Figure Window
If you want to show your plot in a new figure window, then you
can use the command figure just before the command plot.
36 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
53. Plotting in MATLAB
Some Important Additional Commands in Plot
New Figure Window
If you want to show your plot in a new figure window, then you
can use the command figure just before the command plot.
figure
plot(x,y)
36 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
54. Plotting in MATLAB
Some Important Additional Commands in Plot
37 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
55. Plotting in MATLAB
Some Important Additional Commands in Plot
Title
You can give a ”title” to your plot by using the command
title(‘title of plot )
38 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
56. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 9
Plot the function y = xSin(x) over the interval [-10,10] with
the title “Graph of y=xSin(x)”.
39 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
57. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 9
Plot the function y = xSin(x) over the interval [-10,10] with
the title “Graph of y=xSin(x)”.
x=linspace(-10,10);
y=x.*sin(x);
plot(x,y)
title(’Graph of y=xSin(x)’)
39 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
58. Plotting in MATLAB
Some Important Additional Commands in Plot
40 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
59. Plotting in MATLAB
Some Important Additional Commands in Plot
Labeling the Axis
You can labels x-axis and y-axis with the following command:
xlabel(‘x − label string )
ylabel(‘y − label string )
41 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
60. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 10
Plot the function y = xSin(x) over the interval [-10,10] and
also label the axis.
42 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
61. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 10
Plot the function y = xSin(x) over the interval [-10,10] and
also label the axis.
x=linspace(-10,10);
y=x.*sin(x);
plot(x,y)
xlabel(’x’)
ylabel(’y=xSin(x)’)
42 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
62. Plotting in MATLAB
Some Important Additional Commands in Plot
43 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
63. Plotting in MATLAB
Some Important Additional Commands in Plot
Legend
A legend can be added to the plot to identify various curves,
with command:
legend(‘string1 , ‘string2 ..., ‘stringN )
44 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
64. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 11
Plot the function xSin(x), Cos(x) and Sin(x) over the interval
[-10,10] and add a legend to for each.
45 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
65. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 11
Plot the function xSin(x), Cos(x) and Sin(x) over the interval
[-10,10] and add a legend to for each.
x=linspace(-10,10);
y1=x.*sin(x);
y2=cos(x);
y3=sin(x);
plot(x,y1,x,y2,x,y3)
legend(‘xSin(x)’,’Cos(x)’,’Sin(x)’)
45 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
66. Plotting in MATLAB
Some Important Additional Commands in Plot
46 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
67. Plotting in MATLAB
Some Important Additional Commands in Plot
Setting the Limit for Axis
The axis command sets the limits for the current axes of the
plot shown, so only the part of the axis that is desirable is
displayed
axis([xmin, xmax, ymin, ymax])
ax.XLim = [xmin, xmax];
ax.YLim = [ymin, ymax];
Note: We can replace comma by space in each command.
47 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
68. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 12
Plot the function y = e5t
− 1 by the simple command.
48 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
69. Plotting in MATLAB
Some Important Additional Commands in Plot
Example 12
Plot the function y = e5t
− 1 by the simple command.
t=0:0.01:5;
y=exp(5*t)-1;
plot(t,y)
48 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
70. Plotting in MATLAB
Some Important Additional Commands in Plot
49 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
71. Plotting in MATLAB
Some Important Additional Commands in Plot
To get a better idea of the initial behavior of the
function, let’s resize the axes. Enter the following
command into the MATLAB command window :
t=0:0.01:5;
y=exp(5*t)-1;
plot(t,y)
axis([0, 1, 0, 50])
50 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
72. Plotting in MATLAB
Some Important Additional Commands in Plot
51 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
73. Plotting in MATLAB
Some Important Additional Commands in Plot
Note that in Example 11, some part of the curve is not
visible because it is covered by the legend. So to
overcome this problem, we can also use axis command.
x=linspace(-10,10);
y1=x.*sin(x);
y2=cos(x);
y3=sin(x);
figure
plot(x,y1,x,y2,x,y3)
legend(’xSin(x)’,’Cosx)’,’Sin(x)’)
ax=gca;
ax.YLim=[-6 12];
52 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
74. Plotting in MATLAB
Some Important Additional Commands in Plot
53 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
75. Plotting in MATLAB
Some Important Additional Commands in Plot
Upgraded commands
If you are using MATLAB’s latest version (either 2017a or
2017b) then you can replace the commands ax.XTick and
ax.YTick by the following two commands:
xlim([xmin, xmax]);
ylim([ymin, ymax]);
Note: We can replace comma by space in each command.
54 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
76. Plotting in MATLAB
fplot command:
fplot command
Use the fplot command to plot either built-in or user defined
functions between specified limits.
fplot(function, interval)
Syntax with Description:
1 fplot(f) plots input f over the default interval [−5 5] for x.
2 fplot(f, x-interval) plots over the specified interval.
Specify the interval as a two-element vector of the form
[xmin xmax].
55 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
77. Plotting in MATLAB
fplot command:
Example 13
Plot the function xSin(x) over the interval [-20,20].
syms x;
fplot(@(x)sin(x)./x,[-20,20]) fplot(sin(x)/x,[-20,20])
or or
f=@(x)sin(x)./x; syms x;
fplot(f,[-20,20]) f(x)=sin(x)/x;
fplot(f,[-20,20])
All commands will give you the same result.
56 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
78. Plotting in MATLAB
fplot command:
57 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
79. Plotting in MATLAB
fplot command:
Example 14
Plot the piecewise function
f (x) =
ex
, if − 3 < x < 0
cos x, if 0 < x < 3
58 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
80. Plotting in MATLAB
fplot command:
Example 14
Plot the piecewise function
f (x) =
ex
, if − 3 < x < 0
cos x, if 0 < x < 3
syms x;
fplot(exp(x),[-3 0],’b’)
hold on
fplot(cos(x),[0 3],’b’)
axis([-3.5,3.5,-1.1,1.1])
ax=gca;
ax.XAxisLocation=’origin’;
ax.YAxisLocation=’origin’;
58 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
81. Plotting in MATLAB
fplot command:
59 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
82. Plotting in MATLAB
fplot command:
Parametric Plot
fplot command is also used to plot 2-D parametric curve.
fplot(xt, yt, interval)
Syntax with Description:
1 fplot(xt,yt) plots xt = x(t) and yt = y(t) over the
default interval of t, which is [–5 5].
2 fplot(xt,yt,t-interval) plots over the specified interval.
Specify the interval as a two-element vector of the form
[tmin tmax].
60 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
83. Plotting in MATLAB
fplot command:
Example 15
Plot the parametric curve x = cos(t) and y = sin(t).
61 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
84. Plotting in MATLAB
fplot command:
Example 15
Plot the parametric curve x = cos(t) and y = sin(t).
syms t;
fplot(cos(t),sin(t))
axis([-2 2 -2 2])
ax=gca;
ax.XAxisLocation=’origin’;
ax.YAxisLocation=’origin’;
61 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
85. Plotting in MATLAB
Two variable function( or 3D) plot
Two variable function plot process
We can plot a function of two variable z = f (x, y) over the
(x, y) region [a, b] × [c, d] as follows:
Steps:
Find grid of (x, y) points as follows
x=a:h1:b;
y=c:h2:d;
[X,Y]=meshgrid(x,y);
Here we have taken grid points step size h1 in the x-direction
and h2 in the y-direction.
62 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
86. Plotting in MATLAB
Two variable function( or 3D) plot
Apply the function to the grid to get Z-values, where
Z = f (X, Y );
Plot the resulting mesh by the following functions
mesh(X,Y,Z), surf(X,Y,Z)
mesh(X,Y,Z) Generates an open mesh plot of the surface
defined by matrix Z.
surf(X,Y,Z) Generates a shaded mesh plot of the surface
defined by matrix Z.
63 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
87. Plotting in MATLAB
Two variable function( or 3D) plot
Example 16
Use the meshgrid function to generate matrices x and y.
Create a third matrix, z, and plot its mesh and surf over the
(x, y) region [−2, 2] × [−2, 3], where
z = xe−x2−y2
64 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
88. Plotting in MATLAB
Two variable function( or 3D) plot
Example 16
Use the meshgrid function to generate matrices x and y.
Create a third matrix, z, and plot its mesh and surf over the
(x, y) region [−2, 2] × [−2, 3], where
z = xe−x2−y2
x=-2:0.1:2;
y=-2:0.1:3;
[X,Y]=meshgrid(x,y);
Z=X.*exp(-X.^2-Y.^2);
figure
mesh(X,Y,Z)
figure
surf(X,Y,Z)
64 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
89. Plotting in MATLAB
Two variable function( or 3D) plot
Figure: mesh(X,Y,Z)
65 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
90. Plotting in MATLAB
Two variable function( or 3D) plot
Figure: surf(X,Y,Z)
66 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
91. Plotting in MATLAB
Two variable function( or 3D) plot
Contour Plot
Syntax:
contour(x, y, z)
67 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
92. Plotting in MATLAB
Two variable function( or 3D) plot
Contour Plot
Syntax:
contour(x, y, z)
Example 17
Use the meshgrid function to generate matrices x and y.
Create a third matrix z, and plot its contour over the (x, y)
region [−2, 2] × [−2, 3], where
z = xe−x2−y2
67 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
93. Plotting in MATLAB
Two variable function( or 3D) plot
Contour Plot
Syntax:
contour(x, y, z)
Example 17
Use the meshgrid function to generate matrices x and y.
Create a third matrix z, and plot its contour over the (x, y)
region [−2, 2] × [−2, 3], where
z = xe−x2−y2
x=-2:0.1:2;
y=-2:0.1:3;
[X,Y]=meshgrid(x,y);
Z=X.*exp(-X.^2-Y.^2);
contour(X,Y,Z)
67 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
94. Plotting in MATLAB
Two variable function( or 3D) plot
Figure: contour(X,Y,Z)
68 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
95. Plotting in MATLAB
Two variable function( or 3D) plot
Parametric Plot
Example 18
Plot the following:
x = Sin(t), y = Cos(t), z = t where t ∈ [−10, 10]
69 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
96. Plotting in MATLAB
Two variable function( or 3D) plot
Parametric Plot
Example 18
Plot the following:
x = Sin(t), y = Cos(t), z = t where t ∈ [−10, 10]
t=-10:0.1:10;
[T T]=meshgrid(t,t); % or T=meshgrid(t);
x=sin(T);
y=cos(T);
z=T;
mesh(x,y,z)
69 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
97. Plotting in MATLAB
Two variable function( or 3D) plot
70 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
98. Plotting in MATLAB
Two variable function( or 3D) plot
Example 19
The unit sphere centered at the point (0, 0, 1) is given by the
spherical equation
ρ = 2 cos(φ), x = ρ sin(φ) cos(θ), y = ρ sin(φ) sin(θ)
z = ρ cos(φ), where θ ∈ [0, 2π] and φ ∈ [0, π/2]
71 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
99. Plotting in MATLAB
Two variable function( or 3D) plot
Example 19
The unit sphere centered at the point (0, 0, 1) is given by the
spherical equation
ρ = 2 cos(φ), x = ρ sin(φ) cos(θ), y = ρ sin(φ) sin(θ)
z = ρ cos(φ), where θ ∈ [0, 2π] and φ ∈ [0, π/2]
t=0:0.1:2*pi;
p=0:0.1:pi/2;
[T P]=meshgrid(t,p);
R=2*cos(P);
X=R.*sin(P).*cos(T);
Y=R.*sin(P).*sin(T);
Z=R.*cos(P);
mesh(X,Y,Z)
71 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
100. Plotting in MATLAB
Two variable function( or 3D) plot
72 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
101. Plotting in MATLAB
Two variable function( or 3D) plot
f-commands
Just like fplot command in 2D plotting, we have fmesh, fsurf
and fcontour commands in 3D plotting.
Note:
fmesh(f), fsurf(f) and fcontour(f) plot the function
z = f (x, y) over the default interval [-5 5].
Suppose FP denote the fmesh, fsurf and fcontour then
FP(f , xyinterval)
plots over the specified interval. To use the same interval for
both x and y, specify xyinterval as a two-element vector of the
form [min max]. To use different intervals, specify a
four-element vector of the form [xmin xmax ymin ymax].
73 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
102. Plotting in MATLAB
Two variable function( or 3D) plot
If we apply these commands to Example 16 and 17,then we
will get same plots.
syms x y;
f(x,y)=x.*exp(-x.^2-y.^2);
figure
fmesh(f,[-2 2 -2 3])
figure
fsurf(f,[-2 2 -2 3])
figure
fcontour(f,[-2 2 -2 3])
74 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
103. Plotting in MATLAB
Plotting complex numbers
Plotting complex numbers
If the input to the plot command is a vector of complex
numbers, the real parts are used as the x-coordinates and the
imaginary parts as the y-coordinates.
i.e., if z is complex, then plot(z) is equivalent to
plot(real(z), imag(z)).
75 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
104. Plotting in MATLAB
Plotting complex numbers
Plotting complex numbers
If the input to the plot command is a vector of complex
numbers, the real parts are used as the x-coordinates and the
imaginary parts as the y-coordinates.
i.e., if z is complex, then plot(z) is equivalent to
plot(real(z), imag(z)).
Example 20
Define the complex number z = 3 + 2i and plot it as a point
on the complex plane.
z=complex(3,2); z=complex(3,2);
plot(real(z),imag(z),’*’) plot(z,’o’)
75 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
105. Plotting in MATLAB
Plotting complex numbers
76 / 83
Figure: plot(real(z),imag(z),’*’) Figure: plot(z,’o’)Mohd Rafiq, Department of Mathematics, University of Delhi
106. Plotting in MATLAB
Plotting complex numbers
Point to remember:
specify a character (’*’, ’+’, ’x’, ’o’, ’.’, etc) to be plotted
at the point.
Example 21
Define the complex numbers 3 + 2i, −2 + i, −2 − i, 1 − 2i and
plot them all on the complex plane.
z=[3+2i,-2+1i,-2-1i,1-2i];
plot(z,’*’)
axis([-4 4 -4 4])
ax=gca;
ax.XAxisLocation=’origin’;
ax.YAxisLocation=’origin’;
77 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
107. Plotting in MATLAB
Plotting complex numbers
78 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
108. Plotting in MATLAB
Plotting complex numbers
If we don’t define marker point, then by default MATLAB joins
each point (complex number) in the plot by a line segment.
z=[3+2i,-2+1i,-2-1i,1-2i];
plot(z)
axis([-4 4 -4 4])
ax=gca;
ax.XAxisLocation=’origin’;
ax.YAxisLocation=’origin’;
79 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
109. Plotting in MATLAB
Plotting complex numbers
80 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
110. Plotting in MATLAB
Plotting complex numbers
Example 22
Plot the curve z = teit
for t ∈ [0, 4π].
t=0:0.01:4*pi;
z=t.*exp(i*t); % or z=t.*exp(complex(0,t));
plot(z)
axis([-13 13 -13 13])
81 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
111. Plotting in MATLAB
Plotting complex numbers
82 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi
112. Plotting in MATLAB
Plotting complex numbers
Thank You...
83 / 83
Mohd Rafiq, Department of Mathematics, University of Delhi