Make a bar plot

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Make a bar plot or histogram to categorize the "protein content" of the cereal brands in problem 3 (i.e data from the second column)

Workshop 3 Problem 3
Generate a histogram that categorize the cereal brands according
15
DalacerealSurveyNorkshop3 = reudlablef to
21
22
Here, "nbins" is number
of categories. Upon
observation, we know
88 Convert to output type
Datacercalsurvoyworkshop3
23
24 -
table2array
25
ם?
10
110
140
150
160
Cabres
the minimal and
** Clear temporary variables
26
maximal number in Cal
27 -
clcar opt3
You could write a for loop to count like the
one in the previous slide, but MATLAB has a
special automatic counting tool for you:
histogram().
is 50 and 160, so we
28
Cal=DataCerealSurveyWorkshop3 (:, 1);
29 -
nbins=11;
make 11 categories
(50-60, 60-70, 70-80
etc.)
h=histogram(Ca1, nbins);
axis ((50 160 0 351) ;
xlabel ('Calories'): ylabel('Number of the cereal brands');
30 -
31
32 -
You could adjust the axis that reflects
the desired scale.
NUiberof thepe realbaids
Transcribed Image Text:Workshop 3 Problem 3 Generate a histogram that categorize the cereal brands according 15 DalacerealSurveyNorkshop3 = reudlablef to 21 22 Here, "nbins" is number of categories. Upon observation, we know 88 Convert to output type Datacercalsurvoyworkshop3 23 24 - table2array 25 ם? 10 110 140 150 160 Cabres the minimal and ** Clear temporary variables 26 maximal number in Cal 27 - clcar opt3 You could write a for loop to count like the one in the previous slide, but MATLAB has a special automatic counting tool for you: histogram(). is 50 and 160, so we 28 Cal=DataCerealSurveyWorkshop3 (:, 1); 29 - nbins=11; make 11 categories (50-60, 60-70, 70-80 etc.) h=histogram(Ca1, nbins); axis ((50 160 0 351) ; xlabel ('Calories'): ylabel('Number of the cereal brands'); 30 - 31 32 - You could adjust the axis that reflects the desired scale. NUiberof thepe realbaids
Expert Solution
Step 1

In the given data we get protein content and brands  histogram.(we make bar plot using matlab)

==================================================================

line number 30 if we adjust so we can write:

axis([50 160 0 10]);

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education