0
0
MATLABdata~30 mins

Bar and histogram plots in MATLAB - Mini Project: Build & Apply

Choose your learning style9 modes available
Bar and Histogram Plots
📖 Scenario: You are working as a data analyst and need to visualize sales data and customer age distribution for a small store.
🎯 Goal: Create bar and histogram plots in MATLAB to show sales per product and the age distribution of customers.
📋 What You'll Learn
Create a vector with sales data for 5 products
Create a vector with ages of 20 customers
Plot a bar chart for the sales data
Plot a histogram for the customer ages
💡 Why This Matters
🌍 Real World
Bar charts and histograms are common ways to visualize data in business and research to understand quantities and distributions.
💼 Career
Data analysts and scientists use these plots to communicate insights clearly to teams and decision makers.
Progress0 / 4 steps
1
Create sales data vector
Create a vector called sales with these exact values: [150, 200, 180, 220, 170] representing sales for 5 products.
MATLAB
Need a hint?

Use square brackets to create a vector in MATLAB.

2
Create customer ages vector
Create a vector called ages with these exact values: [22, 25, 30, 22, 28, 35, 40, 22, 30, 27, 25, 29, 31, 33, 28, 26, 24, 30, 29, 27] representing ages of 20 customers.
MATLAB
Need a hint?

Use square brackets to create the vector with all 20 age values.

3
Plot bar chart for sales
Use the bar function to create a bar chart of the sales vector.
MATLAB
Need a hint?

Use bar(sales) to create the bar chart.

4
Plot histogram for ages
Use the histogram function to create a histogram of the ages vector.
MATLAB
Need a hint?

Use histogram(ages) to create the histogram.