Matlab, Fourth Edition: A Practical Introduction to Programming and Problem Solving
Matlab, Fourth Edition: A Practical Introduction to Programming and Problem Solving
4th Edition
ISBN: 9780128045251
Author: Stormy Attaway Ph.D. Boston University
Publisher: Elsevier Science
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 12, Problem 12.1P
To determine

To create:

A file that has two lines with n numbers in each and use subplot to show the barh and stacked bar charts side by side.

Expert Solution & Answer
Check Mark

Answer to Problem 12.1P

Solution:

The script file is,

l = load('ponits.dat');

%load the points data file.

subplot(2, 1, 1)

%by using subplot show the bar graph and stacked bar graph side by side.

barh(l);

%plot the bar graph.

xlabel('Values');

%label the x axis as values.

ylabel('Groups');

%label the y axis as values.

subplot(2, 1, 2)

bar(l,'stacked');

%plot the stacked bar.

xlabel('Groups');

%label the x axis as groups.

ylabel('Values');

%label the y axis as values.

Explanation of Solution

Consider, the vectors are,

x=[240536292021]

y=37813141813

MATLAB Code:

l = load('ponits.dat');

%load the points data file.

subplot(2, 1, 1)

%by using subplot show the bar graph and stacked bar graph side by side.

barh(l);

%plot the bar graph.

xlabel('Values');

%label the x axis as values.

ylabel('Groups');

%label the y axis as values.

subplot(2, 1, 2)

bar(l,'stacked');

%plot the stacked bar.

xlabel('Groups');

%label the x axis as groups.

ylabel('Values');

%label the y axis as values.

Save the MATLAB files with name, chapter12_54793_12_1P.m in the current folder. Execute the file by typing the name at the command window to generate output.

Result:

The plot is,

Matlab, Fourth Edition: A Practical Introduction to Programming and Problem Solving, Chapter 12, Problem 12.1P

Therefore, the result is stated above.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
In class, we compared healing times for females who received an experimental cold sore medicine. The data for the male control and treatment groups are provided below; they represent the number of days that passed before the sores were completely gone. In your notebook, make a dotplot for each group. Control: 20,13,22,21,16,5,21,11,16,14,15,15,13,16,10,17,16,11,21 Treatment: 11,16,8,16,15,12,11,12,12,9,11,19,16,13,5,15,12,8,11 Part A: Calculate the mean healing time for the control group, rounding your result to the nearest hundredth. In your notebook, mark an "X" on the horizontal axis of your dotplot to show the mean.Mean =  daysPart B: Calculate the mean healing time for the treatment group, rounding your result to the nearest hundredth. In your notebook, mark an "X" on the horizontal axis of your dotplot to show the mean.Mean =  days
All of the data will be in the two pictures
The rows of seats in The Reed Theatre represent a linear relationship. In row 2 there are 28 seats and in row 4 there are 44 seats. What is the number of seats in row 10?
Knowledge Booster
Background pattern image
Statistics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, statistics and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
Glencoe Algebra 1, Student Edition, 9780079039897...
Algebra
ISBN:9780079039897
Author:Carter
Publisher:McGraw Hill
Text book image
Trigonometry (MindTap Course List)
Trigonometry
ISBN:9781337278461
Author:Ron Larson
Publisher:Cengage Learning
Text book image
Holt Mcdougal Larson Pre-algebra: Student Edition...
Algebra
ISBN:9780547587776
Author:HOLT MCDOUGAL
Publisher:HOLT MCDOUGAL
Text book image
College Algebra
Algebra
ISBN:9781337282291
Author:Ron Larson
Publisher:Cengage Learning
Matrix Operations Full Length; Author: ProfRobBob;https://www.youtube.com/watch?v=K5BLNZw7UeU;License: Standard YouTube License, CC-BY
Intro to Matrices; Author: The Organic Chemistry Tutor;https://www.youtube.com/watch?v=yRwQ7A6jVLk;License: Standard YouTube License, CC-BY