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 is the slides of the UCLA School of Engineering Matlab workshop on Matlab graphics.
Learning Matlab graphics by examples:
- In 2 hours, you will be able to create publication-quality plots.
- Starts from the basic 2D line plots to more advanced 3D plots.
- You will also learn some advanced topics like fine-tuning the appearance of your figure and the concept of handles.
- You will be able to create amazing animations: we use 2D wave equation and Lorentz attractor as examples.
Computer Graphics in Java and Scala - Part 1Philip Schwarz
Computer Graphics in Java and Scala - Part 1.
Continuous (Logical) and Discrete (Device) Coordinates,
with a simple yet pleasing example involving concentric triangles.
Scala code: https://github.com/philipschwarz/computer-graphics-50-triangles-scala
Errata:
1. Scala classes TrianglesPanel and Triangles need not be classes, they could just be objects.
This is the slides of the UCLA School of Engineering Matlab workshop on Matlab graphics.
Learning Matlab graphics by examples:
- In 2 hours, you will be able to create publication-quality plots.
- Starts from the basic 2D line plots to more advanced 3D plots.
- You will also learn some advanced topics like fine-tuning the appearance of your figure and the concept of handles.
- You will be able to create amazing animations: we use 2D wave equation and Lorentz attractor as examples.
Computer Graphics in Java and Scala - Part 1Philip Schwarz
Computer Graphics in Java and Scala - Part 1.
Continuous (Logical) and Discrete (Device) Coordinates,
with a simple yet pleasing example involving concentric triangles.
Scala code: https://github.com/philipschwarz/computer-graphics-50-triangles-scala
Errata:
1. Scala classes TrianglesPanel and Triangles need not be classes, they could just be objects.
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
How to 2D plots in Matlab. Easy steps to graph mathematical functions.
You have to define your interval of interest and consider a step in your independent vector, then you have to define your function and use an appropriate 2D built-in function.
More information and examples:
http://matrixlab-examples.com/matlab-plot-2tier.html
1. Introduction to MATLAB and programming
2. Workspace, variables and arrays
3. Using operators, expressions and statements
4. Repeating and decision-making
5. Different methods for input and output
6. Common functions
7. Logical vectors
8. Matrices and string arrays
9. Introduction to graphics
10. Loops
11. Custom functions and M-files
I am Samuel H. I am a Mechanical Engineering Assignment Expert at matlabassignmentexperts.com. I hold a Ph.D. Matlab, University of Alberta, Canada. I have been helping students with their homework for the past 12 years. I solve assignments related to Mechanical Engineering.
Visit matlabassignmentexperts.com or email info@matlabassignmentexperts.com.
You can also call on +1 678 648 4277 for any assistance with Mechanical Engineering Assignments.
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
How to 2D plots in Matlab. Easy steps to graph mathematical functions.
You have to define your interval of interest and consider a step in your independent vector, then you have to define your function and use an appropriate 2D built-in function.
More information and examples:
http://matrixlab-examples.com/matlab-plot-2tier.html
1. Introduction to MATLAB and programming
2. Workspace, variables and arrays
3. Using operators, expressions and statements
4. Repeating and decision-making
5. Different methods for input and output
6. Common functions
7. Logical vectors
8. Matrices and string arrays
9. Introduction to graphics
10. Loops
11. Custom functions and M-files
I am Samuel H. I am a Mechanical Engineering Assignment Expert at matlabassignmentexperts.com. I hold a Ph.D. Matlab, University of Alberta, Canada. I have been helping students with their homework for the past 12 years. I solve assignments related to Mechanical Engineering.
Visit matlabassignmentexperts.com or email info@matlabassignmentexperts.com.
You can also call on +1 678 648 4277 for any assistance with Mechanical Engineering Assignments.
This 10 hours class is intended to give students the basis to empirically solve statistical problems. Talk 1 serves as an introduction to the statistical software R, and presents how to calculate basic measures such as mean, variance, correlation and gini index. Talk 2 shows how the central limit theorem and the law of the large numbers work empirically. Talk 3 presents the point estimate, the confidence interval and the hypothesis test for the most important parameters. Talk 4 introduces to the linear regression model and Talk 5 to the bootstrap world. Talk 5 also presents an easy example of a markov chains.
All the talks are supported by script codes, in R language.
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxagnesdcarey33086
SAMPLE QUESTION:
Exercise 1: Consider the function
f (x,C)=
sin(C x)
Cx
(a) Create a vector x with 100 elements from -3*pi to 3*pi. Write f as an inline or anonymous function
and generate the vectors y1 = f(x,C1), y2 = f(x,C2) and y3 = f(x,C3), where C1 = 1, C2 = 2 and
C3 = 3. Make sure you suppress the output of x and y's vectors. Plot the function f (for the three
C's above), name the axis, give a title to the plot and include a legend to identify the plots. Add a
grid to the plot.
(b) Without using inline or anonymous functions write a function+function structure m-file that does
the same job as in part (a)
SAMPLE LAB WRITEUP:
MAT 275 MATLAB LAB 1 NAME: __________________________
LAB DAY and TIME:______________
Instructor: _______________________
Exercise 1
(a)
x = linspace(-3*pi,3*pi); % generating x vector - default value for number
% of pts linspace is 100
f= @(x,C) sin(C*x)./(C*x) % C will be just a constant, no need for ".*"
C1 = 1, C2 = 2, C3 = 3 % Using commans to separate commands
y1 = f(x,C1); y2 = f(x,C2); y3 = f(x,C3); % supressing the y's
plot(x,y1,'b.-', x,y2,'ro-', x,y3,'ks-') % using different markers for
% black and white plots
xlabel('x'), ylabel('y') % labeling the axis
title('f(x,C) = sin(Cx)/(Cx)') % adding a title
legend('C = 1','C = 2','C = 3') % adding a legend
grid on
Command window output:
f =
@(x,C)sin(C*x)./(C*x)
C1 =
1
C2 =
2
C3 =
3
(b)
M-file of structure function+function
function ex1
x = linspace(-3*pi,3*pi); % generating x vector - default value for number
% of pts linspace is 100
C1 = 1, C2 = 2, C3 = 3 % Using commans to separate commands
y1 = f(x,C1); y2 = f(x,C2); y3 = f(x,C3); % function f is defined below
plot(x,y1,'b.-', x,y2,'ro-', x,y3,'ks-') % using different markers for
% black and white plots
xlabel('x'), ylabel('y') % labeling the axis
title('f(x,C) = sin(Cx)/(Cx)') % adding a title
legend('C = 1','C = 2','C = 3') % adding a legend
grid on
end
function y = f(x,C)
y = sin(C*x)./(C*x);
end
Command window output:
C1 =
1
C2 =
2
C3 =
3
Joe Bob
Mon lab: 4:30-6:50
Lab 3
Exercise 1
(a) Create function M-file for banded LU factorization
function [L,U] = luband(A,p)
% LUBAND Banded LU factorization
% Adaptation to LUFACT
% Input:
% A diagonally dominant square matrix
% Output:
% L,U unit lower triangular and upper triangular such that LU=A
n = length(A);
L = eye(n); % ones on diagonal
% Gaussian Elimination
for j = 1:n-1
a = min(j+p.
More instructions for the lab write-up1) You are not obli.docxgilpinleeanna
More instructions for the lab write-up:
1) You are not obligated to use the 'diary' function. It was presented only for you convenience. You
should be copying and pasting your code, plots, and results into some sort of "Word" type editor that
will allow you to import graphs and such. Make sure you always include the commands to generate
what is been asked and include the outputs (from command window and plots), unless the problem
says to suppress it.
2) Edit this document: there should be no code or MATLAB commands that do not pertain to the
exercises you are presenting in your final submission. For each exercise, only the relevant code that
performs the task should be included. Do not include error messages. So once you have determined
either the command line instructions or the appropriate script file that will perform the task you are
given for the exercise, you should only include that and the associated output. Copy/paste these into
your final submission document followed by the output (including plots) that these MATLAB
instructions generate.
3) All code, output and plots for an exercise are to be grouped together. Do not put them in appendix, at
the end of the writeup, etc. In particular, put any mfiles you write BEFORE you first call them.
Each exercise, as well as the part of the exercises, is to be clearly demarked. Do not blend them all
together into some sort of composition style paper, complimentary to this: do NOT double space.
You can have spacing that makes your lab report look nice, but do not double space sections of text
as you would in a literature paper.
4) You can suppress much of the MATLAB output. If you need to create a vector, "x = 0:0.1:10" for
example, for use, there is no need to include this as output in your writeup. Just make sure you
include whatever result you are asked to show. Plots also do not have to be a full, or even half page.
They just have to be large enough that the relevant structure can be seen.
5) Before you put down any code, plots, etc. answer whatever questions that the exercise asks first.
You will follow this with the results of your work that support your answer.
SAMPLE QUESTION:
Exercise 1: Consider the function
f (x,C)=
sin(C x)
Cx
(a) Create a vector x with 100 elements from -3*pi to 3*pi. Write f as an inline or anonymous function
and generate the vectors y1 = f(x,C1), y2 = f(x,C2) and y3 = f(x,C3), where C1 = 1, C2 = 2 and
C3 = 3. Make sure you suppress the output of x and y's vectors. Plot the function f (for the three
C's above), name the axis, give a title to the plot and include a legend to identify the plots. Add a
grid to the plot.
(b) Without using inline or anonymous functions write a function+function structure m-file that does
the same job as in part (a)
SAMPLE LAB WRITEUP:
MAT 275 MATLAB LAB 1 NAME: ...
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.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
1. Last modified:January 1, 1970 GMT
An Introduction to Matlab(tm): Lesson 3
New commands in this lesson:
plot(x,y) creates a Cartesian plot of the vectors x & y
plot(y) creates a plot of y vs. the numerical values of the
elements in the y-vector.
semilogx(x,y) plots log(x) vs y
semilogy(x,y) plots x vs log(y)
loglog(x,y)
grid
plots log(x) vs log(y)
creates a grid on the graphics plot
title('text') places a title at top of graphics plot
xlabel('text') writes 'text' beneath the x-axis of a plot
ylabel('text') writes 'text' beside the y-axis of a plot
text(x,y,'text')
writes 'text' at the location (x,y)
text(x,y,'text','sc') writes 'text' at point x,y assuming
lower left corner is (0,0) and upper
right corner is (1,1).
polar(theta,r) creates a polar plot of the vectors r & theta
where theta is in radians.
bar(x)
creates a bar graph of the vector x. (Note also
the command stairs(x).)
bar(x,y) creates a bar-graph of the elements of the vector y,
locating the bars according to the vector elements
of 'x'. (Note also the command stairs(x,y).)
CARTESIAN OR X-Y PLOTS
One of 'matlab' most powerful features is the ability to
2. create graphic plots. Here we introduce the elementary ideas for
simply presenting a graphic plot of two vectors. More complicated
and powerful ideas with graphics can be found in the 'matlab'
documentation.
A Cartesian or orthogonal x,y plot is based on plotting the
x,y data pairs from the specified vectors. Clearly, the vectors x
and y must have the same number of elements. Imagine that you wish
to plot the function ex for values of x from 0 to 2.
x = 0:.1:2;
y = exp(x);
plot(x,y)
NOTE: The use of selected functions such as exp() and sin() will be
used in these tutorials without explanation if they take on an
unambiguous meaning consistent with past experience. Here it is
observed that operating on a matrix with these functions simply
creates a matrix in which the elements are based on applying the
function to each corresponding element of the argument.
Of course the symbols x,y are arbitrary. If we wanted to plot
temperature on the ordinate and time on the abscissa, and vectors
for temperature and time were loaded in 'matlab', the command would
be
plot(time,temperature)
Notice that the command plot(x,y) opens a graphics window. If you
now execute the command 'grid', the graphics window is redrawn.
(Note you move the cursor to the command window before typing new
commands.) To avoid redrawing the window, you may use the line
continuation ellipsis. Consider
plot(x,y),...
grid,...
title('Exponential Function'),...
xlabel('x'),...
ylabel('exp(x)'),
text(.6,.4,' y = exp(x)','sc')
Note that if you make a mistake in typing a series of lines of
code, such as the above, the use of line continuation can be
frustrating. In a future lesson, we will learn how to create batch
files (called '.m' files) for executing a series of 'matlab'
commands. This approach gives you better opportunity to return to
3. the command string and edit errors that have been created.
Having defined the vectors x and y, construct semilog and loglog plots using these or other vectors you may wish to create. Note
in particular what occurs when a logarithmic scale is selected for
a vector that has negative or zero elements. Here, the vector x has
a zero element (x(1)=0). The logarithm of zero or any negative
number is undefined and the x,y data pair for which a zero or
negative number occurs is discarded and a warning message provided.
Try the commands plot(x) and plot(y) to ensure you understand
how they differ from plot(x,y).
Notice that 'matlab' draws a straight line between the datapairs. If you desire to see a relatively smooth curve drawn for a
rapidly changing function, you must include a number of data
points. For example, consider the trigonometric function, sin(x1)
(x1 is selected as the argument here to distinguish it from the
vector 'x' that was defined earlier. )
Plot sin(x1) over the limits 0 <= x1 <= pi. First define x1
with 5 elements,
x1 = 0 : pi/4 : pi
y1 = sin(x1)
plot(x1,y1)
Now, repeat this after defining a new vector for x1 and y1 with 21
elements. (Note the use of the semicolon here to prevent the
printing and scrolling on the monitor screen of a vector or matrix
with a large number of elements!)
x1 = 0 : .05*pi : pi ;
y1 =sin(x1);
plot(x1,y1)
POLAR PLOTS
Polar plots are constructed much the same way as are Cartesian
x-y plots; however, the arguments are the angle 'theta' in radians
measured CCW from the horizontal (positive-x) axis, and the length
of the radius vector extended from the origin along this angle.
Polar plots do not allow the labeling of axes; however, notice that
the scale for the radius vector is presented along the vertical and
when the 'grid' command is used the angles-grid is presented in 15-
4. degree segments. The 'title' command and the 'text' commands are
functional with polar plots.
angle = 0:.1*pi:3*pi;
radius = exp(angle/20);
polar(angle,radius),...
title('An Example Polar Plot'),...
grid
Note that the angles may exceed one revolution of 2*pi.
BAR GRAPHS
To observe how 'matlab' creates a bargraph, return to the
vectors x,y that were defined earlier. Create bar and stair graphs
using these or other vectors you may define. Of course the 'title'
and 'text' commands can be used with bar and stair graphs.
bar(x,y) and bar(y)
stair (x,y) and stair(y)
MULTIPLE PLOTS
More than a single graph can be presented on one graphic plot.
One common way to accomplish this is hold the graphics window open
with the 'hold' command and execute a subsequent plotting command.
x1=0:.05*pi:pi;
y1=sin(x1);
plot(x1,y1)
hold
y2=cos(x1);
plot(x1,y2)
The "hold" command will remain active until you turn it off with
the command 'hold off'.
You can create multiple graphs by using multiple arguments.
In addition to the vectors x,y created earlier, create the vectors
a,b and plot both vector sets simultaneously as follows.
a = 1 : .1 : 3;
b = 10*exp(-a);
5. plot(x,y,a,b)
Multiple plots can be accomplished also by using matrices
rather than simple vectors in the argument. If the arguments of
the 'plot' command are matrices, the COLUMNS of y are plotted on
the ordinate against the COLUMNS of x on the abscissa. Note that x
and y must be of the same order! If y is a matrix and x is a
vector, the rows or columns of y are plotted against the elements
of x. In this instance, the number of rows OR columns in the matrix
must correspond to the number of elements in 'x'. The matrix 'x'
can be a row or a column vector!
Recall the row vectors 'x' and 'y' defined earlier. Augment
the row vector 'y' to create the 2-row matrix, yy.
yy=[y;exp(1.2*x)];
plot(x,yy)
PLOTTING DATA POINTS & OTHER FANCY STUFF
Matlab connects a straight line between the data pairs
described by the vectors used in the 'print' command. You may wish
to present data points and omit any connecting lines between these
points. Data points can be described by a variety of characters
( . , + , * , o and x .) The following command plots the x,y data
as a "curve" of connected straight lines and in addition places an
'o' character at each of the x1,y1 data pairs.
plot(x,y,x1,y1,'o')
Lines can be colored and they can be broken to make
distinctions among more than one line. Colored lines are effective
on the color monitor and color printers or plotters. Colors are
useless on the common printers used on this network. Colors are
denoted in 'matlab' by the symbols r(red), g(green), b(blue),
w(white) and i(invisible). The following command plots the x,y
data in red solid line and the r,s data in broken green line.
plot(x,y,'r',r,s,'--g')
PRINTING GRAPHIC PLOTS
Executing the 'print' command will send the contents of the
6. current graphics widow to the local printer.
You may wish to save in a graphics file, a plot you have
created. To do so, simply append to the 'print' command the name
of the file. The command
print filename
will store the contents of the graphics window in the file titled
'filename.ps' in a format called postscript. You need not include
the .ps suffix, as matlab will do this. When you list the files
in your matlab directory, it is convenient to identify any graphics
files by simply looking for the files with the .ps suffix. If
you desire to print one of these postscript files, you can
conveniently "drag and drop" the file from the file-manager window
into the printer icon.
Back to Matlab In-House Tutorials
7. current graphics widow to the local printer.
You may wish to save in a graphics file, a plot you have
created. To do so, simply append to the 'print' command the name
of the file. The command
print filename
will store the contents of the graphics window in the file titled
'filename.ps' in a format called postscript. You need not include
the .ps suffix, as matlab will do this. When you list the files
in your matlab directory, it is convenient to identify any graphics
files by simply looking for the files with the .ps suffix. If
you desire to print one of these postscript files, you can
conveniently "drag and drop" the file from the file-manager window
into the printer icon.
Back to Matlab In-House Tutorials