0
0
MATLABdata~30 mins

Scatter plots in MATLAB - Mini Project: Build & Apply

Choose your learning style9 modes available
Scatter plots
📖 Scenario: You are a scientist who collected data about the heights and weights of a group of people. You want to visualize this data to see if there is any pattern between height and weight.
🎯 Goal: Create a scatter plot in MATLAB that shows the relationship between height and weight.
📋 What You'll Learn
Create two vectors called height and weight with given data
Create a variable called markerSize to control the size of the scatter plot points
Use the scatter function with height, weight, and markerSize
Add labels to the x-axis and y-axis
Display the scatter plot
💡 Why This Matters
🌍 Real World
Scientists and data analysts often use scatter plots to see if two things are related, like height and weight.
💼 Career
Knowing how to create scatter plots is useful in jobs involving data visualization, research, and reporting.
Progress0 / 4 steps
1
Create the data vectors
Create a vector called height with these exact values: [150, 160, 170, 180, 190] and a vector called weight with these exact values: [50, 60, 70, 80, 90].
MATLAB
Need a hint?

Use square brackets [] to create vectors in MATLAB.

2
Set the marker size
Create a variable called markerSize and set it to 100 to control the size of the scatter plot points.
MATLAB
Need a hint?

Just assign the number 100 to the variable markerSize.

3
Create the scatter plot
Use the scatter function with height, weight, and markerSize to create the scatter plot.
MATLAB
Need a hint?

Use scatter(height, weight, markerSize) to plot the points.

4
Add labels and display the plot
Add the x-axis label 'Height (cm)' using xlabel and the y-axis label 'Weight (kg)' using ylabel. Then display the plot.
MATLAB
Need a hint?

Use xlabel('Height (cm)') and ylabel('Weight (kg)') to add labels.