📖 Scenario: You work in a small company that analyzes sales data. You have two matrices: one with sales quantities and another with prices. You want to find the total sales amount for each product in each region.
🎯 Goal: Build a MATLAB program that multiplies two matrices using the * operator to calculate total sales amounts.
📋 What You'll Learn
Create two matrices with exact values
Create a variable for the result matrix
Use matrix multiplication operator *
Display the resulting matrix
💡 Why This Matters
🌍 Real World
Matrix multiplication is used in many fields like sales analysis, computer graphics, and engineering to combine data efficiently.
💼 Career
Understanding matrix multiplication is essential for data analysts, engineers, and scientists who work with numerical data and models.
Progress0 / 4 steps
1
Create the sales quantity matrix
Create a matrix called quantities with these exact values: [2 3; 4 5]
MATLAB
Hint
Use square brackets and semicolons to create a 2x2 matrix.
2
Create the price matrix
Create a matrix called prices with these exact values: [10 20; 30 40]
MATLAB
Hint
Use the same matrix format as before for prices.
3
Multiply the matrices
Create a variable called total_sales that stores the result of multiplying quantities by prices using the * operator
MATLAB
Hint
Use the * operator to multiply matrices in MATLAB.
4
Display the total sales matrix
Use disp(total_sales) to display the total_sales matrix
MATLAB
Hint
Use disp() to print matrices in MATLAB.
Practice
(1/5)
1. Which of the following statements about matrix multiplication in MATLAB is correct?
easy
A. Matrix multiplication uses the operator .* in MATLAB.
B. The number of columns in the first matrix must equal the number of rows in the second matrix.
C. You can multiply any two matrices regardless of their sizes.
D. Matrix multiplication always produces a matrix of the same size as the first matrix.