0
0
MATLABdata~30 mins

Axis control and formatting in MATLAB - Mini Project: Build & Apply

Choose your learning style9 modes available
Axis control and formatting
📖 Scenario: You are creating a simple plot to show the relationship between two sets of data points. You want to control the axis limits and add labels to make the plot clear and easy to understand.
🎯 Goal: Build a MATLAB script that plots data points, sets specific axis limits, and adds axis labels with formatting.
📋 What You'll Learn
Create vectors for x and y data points
Set axis limits using axis
Add labels to x-axis and y-axis using xlabel and ylabel
Format axis labels with font size and font weight
💡 Why This Matters
🌍 Real World
Controlling axis limits and formatting labels is important when creating clear and professional graphs for reports, presentations, or data analysis.
💼 Career
Many jobs in engineering, science, and data analysis require creating plots that communicate data clearly. Knowing how to control axes and labels is a basic but essential skill.
Progress0 / 4 steps
1
Create data vectors
Create two vectors called x and y with these exact values: x = [1 2 3 4 5] and y = [2 4 6 8 10].
MATLAB
Need a hint?

Use square brackets to create vectors in MATLAB, separate numbers with spaces.

2
Plot data and set axis limits
Use plot(x, y) to plot the data points. Then set the axis limits to [0 6 0 12] using the axis function.
MATLAB
Need a hint?

Use plot(x, y) to draw the graph and axis([xmin xmax ymin ymax]) to set limits.

3
Add axis labels
Add an x-axis label with the text 'Time (seconds)' using xlabel. Add a y-axis label with the text 'Distance (meters)' using ylabel.
MATLAB
Need a hint?

Use xlabel('text') and ylabel('text') to add labels.

4
Format axis labels
Set the font size of both axis labels to 14 and font weight to 'bold' using the set function with the label handles returned by xlabel and ylabel.
MATLAB
Need a hint?

Store the output of xlabel and ylabel in variables, then use set to change properties.