Plotting
Questions
Session
James Andrew Smith, PhD, P.Eng.
EECS 1011
Sept 2023
Copyright James Andrew Smith & others. Not for distribution outside York University.
Reference 1
• You should be following along in Section 3.5 of the Stormy
Attaway MATLAB text from the Library (2019 edition)
• Try end-of-chapter problems 15, 16 and 17, too
Chapter 3
(Up to and including
Section 3.5)
Copyright James Andrew Smith & others. Not for distribution outside York University. 7
Reference 2
• You should have watched the YouTube video ahead of
the class
https://youtu.be/yarL7o8khpI
Plus, look for the EECS1011
playlist on my YouTube Channel
Copyright James Andrew Smith & others. Not for distribution outside York University. 8
https://youtu.be/yarL7o8khpI
Visualization is a key skill for
engineers and scientists
Key for debugging programs
Why plotting?
Important in Get the idea out of Draw on paper Faster
all domains your head and into
the real world by at first Cheaper
for “ideation” drawing Universal
and product
development Make your ideas Draw on More precise
more professional &
refined computer to More detailed
finish Cleaner
Copyright James Andrew Smith & others. Not for distribution outside York University.
Visualization is a key skill for
engineers and scientists
Key for debugging programs
Why plotting?
Important in Get the idea out of Draw on paper Faster
all domains your head and into
the real world by at first Cheaper
for “ideation” drawing Universal
and product
development Make your ideas Draw on More precise
more professional &
refined computer to More detailed
finish Cleaner
Copyright James Andrew Smith & others. Not for distribution outside York University.
Visualization is a key skill for
engineers and scientists
Key for debugging programs
Why plotting?
Important in Get the idea out of Draw on paper Faster
all domains your head and into
the real world by at first Cheaper
for “ideation” drawing Universal
and product
development Make your ideas Draw on More precise
more professional &
refined computer to More detailed
finish Cleaner
Copyright James Andrew Smith & others. Not for distribution outside York University.
Visualization is a key skill for
engineers and scientists
Key for debugging programs
Why plotting?
Important in Get the idea out of Draw on paper Faster
all domains your head and into
the real world by at first Cheaper
for “ideation” drawing Universal
and product
development Make your ideas Draw on More precise
more professional &
refined computer to More detailed
finish Cleaner
Copyright James Andrew Smith & others. Not for distribution outside York University.
Visualization is a key skill for
engineers and scientists
Key for debugging programs
Why plotting?
Important in Get the idea out of Draw on paper Faster
all domains your head and into
the real world by at first Cheaper
for “ideation” drawing Universal
and product
development Make your ideas Draw on More precise
more professional &
refined computer to More detailed
finish Cleaner
Copyright James Andrew Smith & others. Not for distribution outside York University.
Visualization is a key skill for
engineers and scientists
Key for debugging programs
Why plotting?
Important in Get the idea out of Draw on paper Faster
all domains your head and into
the real world by at first Cheaper
for “ideation” drawing Universal
and product
development Make your ideas Draw on More precise
more professional &
refined computer to More detailed
finish Cleaner
Copyright James Andrew Smith & others. Not for distribution outside York University.
Visualization is a key skill for
engineers and scientists
Key for debugging programs
Why plotting?
Important in Get the idea out of Draw on paper Faster
all domains your head and into
the real world by at first Cheaper
for “ideation” drawing Universal
and product
development Make your ideas Draw on More precise
more professional &
refined computer to More detailed
finish Cleaner
Copyright James Andrew Smith & others. Not for distribution outside York University.
On paper, draw the following
Copyright James Andrew Smith & others. Not for distribution outside York University.
On paper, draw the following
A line defined by the following sets of point pairs (x, y)
• (1, 10)
• (2, 20)
• (3, 100)
• (4, 200)
• Add a marker to each data point pair on the line
• Create a box around the plot
• Add numbers to both the x axis and y axis
Copyright James Andrew Smith & others. Not for distribution outside York University.
Sample Question 1
• What is the result of this operation in MATLAB? (ignore the “ans =”)
>> 98 + 10 - (12 + 22)
a) 142
b) 29
c) 118
d) 74
e) None of the above
Copyright James Andrew Smith & others. Not for distribution outside York University.
Sample Question 1 (Answered)
• What is the result of this operation in MATLAB? (ignore the “ans =”)
>> 98 + 10 - (12 + 22)
a) 142
b) 29
c) 118
d) 74
e) None of the above
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 1
• What is the result of this operation in MATLAB? (ignore the “ans =”)
>> 5 + 2 – (6 + 2)
a) 10
b) -1
c) 6
d) 22
e) None of the above
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 2
• In the example from 3.5.1 in the book, what were
the two axes labelled as?
a) Speed vs. Date
b) Sales vs. Year
c) Temperature vs. Time
d) Y vs. Z
e) None of the above
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 3
• In the video, a problem occurs with the figure
(around 4 min). What happened?
a) The line of the plot was white, and so was the background colour.
b) The font was too small and needed to be increased.
c) No figure was created. I forgot how to use the plot function.
d) The figure appeared behind the main window.
e) None of the above
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 4 (1 of 6)
• What is the result of this operation in MATLAB? (ignore formatting.
Thicker lines are a visual aid, not part of command)
>> plot([10 20 30 40], [1 5 6 7])
None of
The
Above
A. B. C. D. E.
Copyright James Andrew Smith & others. Not for distribution outside York University.
(2 of 6)
>> plot([10 20 30 40], [1 5 6 7])
(a)
Copyright James Andrew Smith & others. Not for distribution outside York University.
>> plot([10 20 30 40], [1 5 6 7]) (3 of 6)
(b)
Copyright James Andrew Smith & others. Not for distribution outside York University.
(4 of 6)
>> plot([10 20 30 40], [1 5 6 7])
(c)
Copyright James Andrew Smith & others. Not for distribution outside York University.
(5 of 6)
>> plot([10 20 30 40], [1 5 6 7])
(d)
Copyright James Andrew Smith & others. Not for distribution outside York University.
(6 of 6)
(e) None of the above / none of the previous
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 5
I want to write text over a figure. (i.e. above)
What MATLAB command should I use?
a) overfigure('this is my text')
b)Write_txt_over_fig(’this is my text’)
c) xlabel('this is my text')
d)title('this is my text')
e) None of the above
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 6
How many numbers appear in variable x?
>> x = [3 : 21]
a) 19
b) 21
c) 20
d) 12
e) None of the above
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 7 (page 1 of 2)
• I need to make a bar chart
in MATLAB that looks like
this. Choose the best
version of the command
below.
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 7 (2 of 2)
a) >> bar([1 2 3 4], [10 20 60 5]); xlabel('days'); ylabel('money')
b) >> bar([5 4 3 2 1], [5 20 60 50 20]); xlabel('days');ylabel('money')
c) >> bar([1 2 3 4 5], [10 20 60 5 20]); xlabel('days'); ylabel('money')
d) >> bar3([1 2 3 4 5], [10 20 60 5 20]); xlabel('days'); ylabel('money')
e) None of the above
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 8 (1 of 2)
Try the following command in MATLAB
>> bar3([1 2 3 4 5], [10 20 60 5 20]); xlabel('days'); ylabel('money')
What button (icon) in the
figure window can I use to
rotate the bar chart?
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 8 (2 of 2)
Try the following command in MATLAB
>> bar3([1 2 3 4 5], [10 20 60 5 20]); xlabel('days'); ylabel('money')
What button in the figure window can I use to rotate the bar chart?
(a) (b) (c ) (d) (e)
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 9
Which command will make a red-coloured plot?
a) >> plot([10 20 30],[9 8 7], 'k-d')
b) >> plot([10 20 30],[9 8 7], 'y-*')
c) >> plot([10 20 30],[9 8 7], 'yellow')
d) >> plot([10 20 30],[9 8 7], 'r--o')
e) None of the above.
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 10
What colour will the marker be for this command? (use the official
terminology used by MATLAB)
>> plot([10 20 30],[9 8 7],'k-p')
The “marker” is the shape that appears on the line
in the plot to show data points.
Copyright James Andrew Smith & others. Not for distribution outside York University.
Question 11
How are you using iClicker?
a) WiFi + cell phone
b) Cell service + cell phone
c) WiFi + computer
d) Cell service + computer
e) I’m not using iClicker