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: 9780128045411
Author: ATTAWAY
Publisher: ELSEVIER
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!
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
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:9781133382119
Author:Swokowski
Publisher:Cengage
Text book image
Linear Algebra: A Modern Introduction
Algebra
ISBN:9781285463247
Author:David Poole
Publisher:Cengage Learning
Text book image
Algebra for College Students
Algebra
ISBN:9781285195780
Author:Jerome E. Kaufmann, Karen L. Schwitters
Publisher:Cengage Learning
Text book image
College Algebra
Algebra
ISBN:9781305115545
Author:James Stewart, Lothar Redlin, Saleem Watson
Publisher:Cengage Learning
Text book image
Intermediate Algebra
Algebra
ISBN:9780998625720
Author:Lynn Marecek
Publisher:OpenStax College
Text book image
College Algebra (MindTap Course List)
Algebra
ISBN:9781305652231
Author:R. David Gustafson, Jeff Hughes
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